Wednesday was the inaugural Laracon Online, an online conference devoted to bringing great Laravel teaching to folks who may not be able to attend an in-person conference. Tighten co-founder Matt Stauffer spoke on Laravel's service container, along with Taylor Otwell, creator of Laravel; Jeffrey Way, creator of Laracasts; Adam Wathan, Tighten alum; and several more excellent speakers.
During the session, conference attendees asked questions for the speakers to answer after their talks were over.
However, the Slack channel was a fast-paced mix of conversations and Q&A, so we wanted to aggregate the Q&A sessions that did happen together in a single place.
Here's the speaker list:
If you didn’t attend the conference, not to worry! Most of the Q&As are completely independent of the talk, but as an added measure, we’ve separated the overly technical or “you had to be there” questions, so feel free to skip those.
Q: Are you still holding on to your 4 hours work days? A: Not as much anymore, but I did that for the first months after our daughter was born.
Q: For beginners, where’s the best resource to learn and understand webpack easily? A: Webpack for Everyone and the main Webpack guide.
Q: Is it possible to install Laravel Mix as a standalone for a non-Laravel project (like a single page application)? A: Yep.
Q: Do you worry about keeping up with the JS community? Do you think it's okay to find a framework/stack and stick with it, or is it important to try new things A: Yes. You don’t have to keep up. There will always be the early adopters.
Q: Do people still use coffeescript? Is it still viable? A: A lot of people do.
Q: Seeing that your talk is focused in front end, I am interested to know if you have any plans to dive into mobile app development tutorials at laracasts? We use Ionic at our company and it really is awesome and 99% like developing a front-end app. Thank you! A: No plans. My mobile app dev skills are nonexistent.
Q: Are you more into JS than PHP these days? A: Not really. I use both every day.
Q: What's the difference between ES5 and ES6? A: ES6 is the next version of ECMAScript, and includes a bunch of new features that I quickly went over at the end of the presentation.
Q: How we can make the laravel more speedy? A: Increase flux nodes by 5.
Q: I see you've more or less rebranded Laracasts to a more general web development website, both in how the site is presented and the content you've released. Any further plans to move away from the "laravel brand" in terms of reaching a broader audience? A: Not really. Laravel will always be the base for most of the content. I’m not suddenly going to start covering Python or mobile app dev.
Q: Will we get more Bulma content? A: Maybe! Love Bulma
Q: Do you have any plans for upcoming features in laravel mix? A: Next thing I’m going to tag is CSS purification. That’s where we’ll scan all your views, and remove any CSS selectors that aren’t being used from the generated CSS file.
Q: You should make videos for Khan Academy. A: Coca Cola should also start making drinks for Pepsi.
Q: Where did you learn to write your creative alert messages for your web applications? A: I use sweetalert.
Q: Did you find a good way to fish in Zelda? (No counting swimming after the fish or bombing them) A: Haven’t fished yet. I did learn the other day that you can use a fire arrow on meat to cook it. haha.
Q: I read somewhere you were a fan of dreamweaver. What version did you like best? A: ...
Q: Yes but should we get it with Wii-U or just fork out the money for switch A: 100% Switch, if you have the means.
Q: How are you feeling about your workload? Have you talked to Ryan Bates about his burnout? A: No - but I always assumed it was burnout. He completely disappeared.
Q: I suppose npm run production
as post deployment hook is much better idea?
A: You can do either. I’m always scared to do my build on the production server, but a lot of people do.
Q: How does versioning work with extraction? Does it not version the extracted vendor libraries? A: It’ll version the extracted files too.
Q: Why is webpack’s use
right to left?
A: Have no idea. I’m sure there’s a good reason for it.
Q: What do you think about post-css?
A: Laravel Mix uses it behind the scenes for things like autoprefixing. You can hook in your own postcss plugins with mix.options({ postCss: [‘plugins here’]})
Q: Does this mean the style tags gets added with javascript? Any "flash of unstyled content" issues? A: Yes, this could be an issue. That’s why I’d generally recommend extracting a dedicated CSS file. Otherwise, you could also consider pushing your bundle.js script import back to the head tag of the document.
Q: What about typescript?
A: You can manually add configuration with mix.webpackConfig()
, but I’m thinking about adding a mix.typeScript()
helper that would do the work for you.
Q: Thanks for your presentation! Is there anything special I need to do to enable tree-shaking? It went by a bit fast … can I use treeshaking if I don’t write ES-2015? A: It’ll happen automatically when you import the module. import {thing} from ‘library’
Q: Sorry, asking one more time. Is is possible to selectively .vendor() specific outputs to enable cache busting but retain long lived cache on artifacts like vendor.js. A: Mix will do that automatically. The hash will be based upon the file’s contents.
Q: Does laravel-mix help with lazy loading? Will you be covering on Laracasts? A: Webpack allows you to lazy load what you need on demand.
Q: Will your team ever be tempted to remove inline templates from Vue? That would be the worst. A: We are never going to remove templates, no
Q: Do you think you'll crush React? A: I don’t think one framework can actually “crush” the other, there are some overlap in the target audience of each framework, but also a lot of difference. React/Angular/Vue are more like 3 circles with some overlap rather than a “winner takes all” scenario
Q: How old are you? A: I’m 29
Q: What IDE/Packages for that ide are you using at the moment for writing vue code? A: I use Sublime Text
Q: Hey evan, great talk! I read on medium about Marko.js which forgoes Virtual DOM and writes directly to string buffer, which supposedly makes it a lot faster compared to other frameworks. Are you planning to do something like this with vue? A: Marko has really great performance, but it lacks the capability of allowing hand-written render functions which I think is quite important for building lower-level libraries. Also the perf is somewhat case dependent - most of the SSR perf difference would be much less significant when you take caching into account
Q: what do you think about jest? A: I used it in a few smaller projects and am liking it. Will probably investigate an official pre-processor to make it easier to use with Vue
Q: You scratched it in your talk, but will there be any SSR possibilities like what hypernova does for react?
A: Not exactly sure which aspect you are referring to, but Vue’s bundleRenderer
has a similar mechanism for preventing cross-request state polution, and Nuxt.js is a higher-level framework that drastically simply SSR usage
Q: Sorry, reading my question twice, yeah it is lacking specificness. I was talking about the “wrapping things up” in a protocol which you are able to implement in multiple "backend languages” other than js via node like ruby, python, or php. (regarding hypernova) Thanks for your response, tho A: Ah yeah, that is a good point and probably something we will look into in the near future, but ideally I hope there could be community contribution in this aspect
Q: When using Webpack in a Laravel application, I make use of Vue components but there are sometimes I just need a small logic which I feel does not require creating a dedicated template. In cases like this, I cannot use an inline template because if I get runtime build errors. What option do I have in this case? A: You can just switch to the standalone build to get template compilation capabilities (by configuring an alias in Webpack)
Q: Your thoughts on CSS preprocessors? A: I use Sass, no particular thoughts other than don't make a horrible mess with it
Q: Do you have any experiences with Flexbox in React Native? Is flexbox can work properly? A: I'm not a React person so I don't know
Q: The dense flow is pretty slick … can it work in both directions at the same time? i.e. a masonry replacement? A: Masonry is a bit of a weird beast, it's almost a hybrid of flex and grid. I'd like to solve it. see this article_
Q: Why use the support rather than just specify both?
.item { display: none; display: flex;}
A: You don't need to use feature queries if none of your overrides would conflict with the things you are doing for an old browser, but say you need to reset a width, the feature query stops it being used by the old browser that needs the width.
Q: How much do you bench/deadlift? A: my best bench is 400lb, best squat is 550lb, best deadlift is 601lb
Q: How are you firing just the single test so easily from Sublime. Can it be done is PhpStorm as well? A: to fire individual tests in PHPStorm check out this post: https://blog.jetbrains.com/phpstorm/2017/01/working-with-phpunit-and-phpstorm/ for sublime users i wrote about it here: https://adamwathan.me/2017/01/16/optimizing-your-phpunit-workflow-in-sublime-text/
Q: What does the tap()
function do? Is that part of Laravel? Couldn't seem to find it.
A: Yeah, tap
is part of laravel; it returns its first argument, but gives you a callback to work with that object before it's returned.
sort of cleans up code like :
$foo = new Foo;$foo->this();$foo->that();$foo->andTheOther();return $foo;
Q: Does the course leaving early access mean you will consider it "complete" then? A: No it will still be in early access until all the content is published, but just going to raise the price a bit soon since i've added a lot more content since the initial release, and i'd like to reward the people who supported me at the beginning by making sure they got the best deal
Q: I switched to Laravel 5.4 recently and I am testing against my LoginController. I have the following;
$response = $this->post(route('auth.post_login', ['email' => $user->email, 'password' => 'testpass'])); $response->assertRedirect('/profile/show/member/' . $user->member_id);
This works but I am unable to $this->assertSee('Logged In')
because somehow the post call does not follow redirects. How do I test what is on the redirected page. Is this even possible at all?
A: With the following redirects stuff, i wouldn't worry about testing what shows up the final page you are redirect to, personally just knowing the redirect happen would give me enough confidence
Q: What do you think of testing frameworks like Peridot / Leo A: I haven't seen peridot before so i will have to look into it! i usually just stick with the basics
Q: In the Test Driven Laravel course i see you never use dataproviders. Why? A: Honestly, no great reason! I just never find myself in a situation where that seems like the solution, i should play with them more though.
Q: This was an fantastic talk. Will you be at the LaraconEU? A: wont be at laracon EU sadly, having a baby that week
Q: Any ELI5 resources for a complete noob to testing. Is you tdd course testing beginnner friendly? A: My course definitely assumes some familiarity with the tools already, so if you want to learn real fundamentals from scratch before learning about higher level testing strategy stuff, chris hartjes has a book that looks pretty good, "Minimum Viable Testing" i think is the name
Q: What are your favourite testing frameworks? PHPUnit or PHPSpec? Behat or Codeception? A: I like PHPUnit, have never had an issue with it. boring and simple
Q: What kind of caffeine do you use when coding/talking? A: I drink a rockstar every morning like a psychopath because i dont like coffee, i am basically 12 years old
Q: Any books or articles your recommend? For TDD. A: Sure! heres a gist to some of my favorite stuff: https://gist.github.com/adamwathan/fc5cbe7c0f5629245944
Q: Do you plan on covering acceptance tests with Laravel Dusk in your Test Driven Laravel course? A: Yeah, I will be adding a module on it towards the end
Q: What's you're favorite metal band, if you had to choose one other than Slayer? A: Haha, really hard to say, i have a lot of bands i love for nostalgic reasons and then stuff im into right now. some of my favorite stuff over the long haul are bands like At The Gates, Death, pre-black album Metallica has a special place in my heart, lots of other bay area thrash stuff like testament and forbidden, meshuggah before Nothing came out :eyes: haha too much stuff
Q: Do you ever test the performance of the web applications with loads of dummy data to see where it breaks down if you possibly have a lot of users / data? A: I haven't personally, no, performance and load testing definitely not an area of expertise for me
Q: Would you test all aspects of a CRUD resource? Like user_can_update_their_own_thing
and user_cannot_update_another_users_thing
? I’m feeling like I’m doing a lot of repeating myself
A: I usually do honestly, yeah. if I want to add an authorization rule to a controller action, i add a test for it first
Q: How do we test when external services return non-fixed values? For example, I have a google api that returns a minutely different distance value over time? A: RE: the google api thing, if you can write a fake that at least doesn't confuse the rest of your app, I would do that, doesn't matter if it's perfect usually
Q: I agree with the limiting the mocks, but I would assume you would be on board with mocking out heavier pieces of internal code. A: Yeah, I have no problem with mocks at all, they are a great tool. i am mostly trying to make the counterpoint to the common suggestion that everything should always be mocked, and if you ever use real collaborators you are "doing it wrong”
Q: I noticed that you return a value from your command handler, is there any context were you wouldn’t do that? Thinking of CQRS. A: I really have no idea, haha. I know some people say never do it, i dont actually use commands or anything in any of my own projects so dont have strong opinions
Q: Maybe we should not make Controller unit tests and remain only feature ones? A: Definitely agree on controller tests being silly period, i definitely prefer to test from one layer out, even if replacing some of the controllers dependencies with test doubles
Q: Just wondering, what is the future for laravel spark? Us developers see it getting updates here and there but does It actually have a future in the laravel ecosystem? A: what do you want it to do? A: we keep it updated and fix bugs, but I feel like the main feature set I set out to include is there
Q: I couldnt find anything on in the docs, but can Spark support additional charges added to a plan? Say you had a plan for $49 that had 5 users. Could you add like a $5 per user past the 5th without moving to another plan? A: Stripe only recently added multiple plans per subscription which makes that kind of thing possible; we would have to see how much more complicated it makes spark. They added it maybe 2 weeks ago?
Q: Laravel Certification update? A: I do not manage certification so I don't have info on that
Q: How do you break up your time every day? For instance, are you working on laravel 50%? Forge 20%? Researching 10%? Etc. Do you have a rhythm? Or is it just what you feel ? A: I work on laravel pretty much 90% of the time. Mohamed has taken over much of Forge maintenance. The first 2 hours of my day are pretty much email and GitHub. And then I settle in and work on whatever laravel stuff I need to work on
Q: How do you keep track what you need to work on? A: Right now I'm mainly just working on horizon
Q: To learn something new, we come to these conferences and read stuff online. What are your reliable sources for learning to be better at what you do? A: Google and Laracasts lol
Q: Hi ! I would like that a future version of Laravel to be (even) more packagable, and with no Vues.js dev dependencies. A: the only vue.js dependency in laravel is the empty example.vue file. There is no other dependency Just remove that file and the package.json dependency or whatever.
Q: May be it will help improving Laravel internals if you write small examples of using some components in not only Laravel applications? A: Check out GitHub.com/mattstauffer/torch
Q: Laravel has echo which uses pusher by default. are they any plans for an addon websocket server? A: The only other one we ship right now is the socket.io backend... I'm not personally familiar with others enough to add them but feel free to send a PR if its pretty easy to integrate one
Q: How do you stay focused? Like how do you teach yourself that you need to work atleast X hours on this X laravel thing today? A: Only work on things I'm interested in... sometimes this isn't a practical choice for everyone heh
Q: Do you have any advice or recommended resources on how to contribute to the framework. I'd love to be able to submit a PR to the laravel repo and contribute but I don't have a great idea of where to get started. Thanks again for your talk and the framework as a whole, it's made my work life very enjoyable! A: One of the most helpful things is to look at GitHub issues and see what people are struggling with a lot, and try to fix one of those things, or stack overflow threads.
Q: whats your personal vision with Laravel for next few years? A: I don't tend to plan that far ahead, I just sort of take it one release at a time and improve it how we can based on the community feedback, etc.
Q: I thought it was world domination! A: That too!
Q: Great talk, thanks. Do you have any suggested resources for email open tracking, and also importing emails in to a system, e.g. the json approach. A: I'd look into whatever service you're using to send out emails, like if you're using Mailgun or Sendgrid, they all have support for open tracking as far as I know
Q: I see your helpdesk is identifying Inbound emails by the "References" header. Does that header get preserved across messages? A: You can use References header, but some email clients add different types of headers. Sometimes it's In-reference-to, and there are few others ones
Q: How are you able to get "Opened in Gmail for 30 sec A: We use a special open tracking pixel - we wrote a custom http server thing that slowly "feeds" the pixel when it's requested, so the idea is that if it keeps getting requested, the email is still open - It's not perfect, but worked pretty well.
Q: Is there also such a nice tool to analyze bounce email headers? we have mails that can't be delivered and all involved instances say thats not their fault A: Yeah, bounce processing is hard. We do our best at Postmark, but it still takes a lot of eyeballing - Here is the google tool I mentioned that you can paste message headers into, it might give you some more information_ -https://toolbox.googleapps.com/apps/messageheader/
Q: If you do a WIP commit and then commit something else separate that has a meaningful commit message - how do you deal w/ this situation where you now have a WIP commit in the commit logs? are you rebasing to handle this? A: Yes. Rebase in that case to reorder or "squash" the commits.
Q: Do you recommend persons new to Git, always learn the commands at the command line first or if they are not so inclined they just use a GUI tool right away? A: Yes. I do. That way you have a fundamental understanding. From there you can use other things. If you want to improve your Git skills, I recommend my video series Getting Git.
Q: What workflow would you recommend for a really small team, like 3 people? A: GitHub Flow
Q: About flows: Any recommendations for feature branches that have to share code apart from making them short-lived? Cherry-picking?
A: You can create a "feature" branch off a "feature" branch if necessary. As both will contain the same commits. cherry-pick
will ultimately change the commit history. So, no good.
Q: What does a hotfix look like in your github flow scenario?
A: It would just be a "feature branch" containing the "hotfix". Since main
is always in a "production ready" state, you could then deploy after merge.
Q: How do you manage the flow from environment to environment with the GitHub flow?
Every environment gets main
deployed.
Git != deployment.
A common misconception.
It is a version control tool. Not a CD tool.
Q: If we have scheduled release cycles, which flow should I use? A: While it depends, git flow may be a better fit with its "release" branches. Otherwise, with GitHub flow you may be in a situation where you have to freeze the main branch. In the end, I prefer starting with GitHub Flow and transitioning into git flow once I find the need.
Q: what would you do during acceptance testing?
Test main
in the "testing" environment. When good. Move on to prod environment.
Q: do have freezes on main? A: Sometimes.
Q: Unrelated to strictly laravel talk, but is there a community/forum/roadmap/etc for Jigsaw A: Great question! We have one massive piece of work we’re pushing on and then I think organizing around community would definitely be a great idea—right now everything comes in through GitHub issues.
Q: Can Matt release his book in audio format... read by himself? Please and thank you. A: Haha, then I could have even more people telling me I talk too fast!!
Q: Not a dev related question but is it creepy that I appreciated almost listening to your kid grow up while I binge listened to your podcast after discovering it? A: Not creepy at all. I love it. One of my favorite parts about doing the podcast. Thanks!!
Q: Here's a question for another talk: How to go from this being a hobby and something I do for friends and family to "I think I can sleep at night charging for this" A: Do as much work for free as you can afford. Open source, donation to non profits, whatever. Get CLIENT experience but also practical experience from that.
Then start working with small businesses. Charge a good rate but give them local business discounts, etc. Build up your experience, professionalism, and portflio.
Then start applying. Be willing to work crappy entry level jobs at first. Don’t start with google.
Q: I would think twice about offering services to charities, just because it can be super frustrating. People who are paying for your time value it much more than people who aren't. A: Yes—this is so, so true. I should caveat that—it’s really important to set boundaries around your free work. This is a totally viable step to skip if you can—but if you can’t, and you just need something, this is a place to start. But yes—many many cautions on free work. MANY.
Q: Is there any way to type hint the short alias for providers? A: Nope.
Q: Do contextual bindings act as an override in general? A: As far as I undestand, yes.
Q: you mentioned in the BONUS section of your talk the call
method and as an example you said we can call on current object ($this)
Q: in which situations app()->call([$this, $method])
is better than call_user_func_array([$this, $method])
after all when I work in the context of an object I already have its deps resolved and instantiated?…
A: If you have method-level dependencies instead of class-level dependencies.
We appreciate your interest.
We will get right back to you.