Easily use Laravel policy methods
Tweet – – twitter.com
?❗ You can add custom methods to your #laravel policies and use them with "kebab-case". pic.twitter.com/cRjctkuI80
— Sven (@svenluijten) October 28, 2017
Oh Dear is the all-in-one monitoring tool for your entire website. We monitor uptime, SSL certificates, broken links, scheduled tasks and more. You'll get a notifications for us when something's wrong. All that paired with a developer friendly API and kick-ass documentation. O, and you'll also be able to create a public status page under a minute. Start monitoring using our free trial now.
Tweet – – twitter.com
?❗ You can add custom methods to your #laravel policies and use them with "kebab-case". pic.twitter.com/cRjctkuI80
— Sven (@svenluijten) October 28, 2017
PhpStorm is a fantastic editor. Unfortunately it can be quite slow. Brent, one of our developers at Spatie, blogged a few tips to make it run a bit faster. I've followed all his suggestions and PhpStorm now feels a bit more responsive.
I didn't start this post by writing my own thoughts, because I figured people were looking for some quick tips to speed of their IDE. As a PHP developer, I think that PhpStorm is such a powerful tool, which helps me to write good and maintainable code. I don't want it to stand in my way though, so good performance is an absolute requirement.
https://www.stitcher.io/blog/phpstorm-performance
Hopefully future versions of PhpStorm will be more performant out of the box.
Stay up to date with all things Laravel, PHP, and JavaScript.
You can follow me on these platforms:
On all these platforms, regularly share programming tips, and what I myself have learned in ongoing projects.
Every month I send out a newsletter containing lots of interesting stuff for the modern PHP developer.
Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.
Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.
My colleague Sebastian took the time to write down the solution to a problem many artisans will come across at some point in time. I hope that in a future version of Laravel that error message will be improved so that it makes clear what the actual problem really is.
Every now and then I come across a Class log does not exist exception in Laravel. This particular exception is thrown when something goes wrong really early in the application, before the exception handler is instantiated.Whenever I come across this issue I'm stumped. Mostly it's related to an invalid configuration issue or an early service provider that throws an exception. I always forget how to debug this, so it's time to document my solution for tracking down the underlying error.
Tweet – – twitter.com
Just a little reminder that Carbon is macroable in #Laravel 5.5 pic.twitter.com/6l7F883c7N
— Freek Van der Herten (@freekmurze) October 22, 2017
Clockwork is Laravel package, made by itsgoingd, that can collect a lot of helpful info such as queries executed, views loaded, route used, ... Unlike the popular laravel-debugbar package, Clockwork will not inject extra stuff into the html itself. All collected info is displayed in the developer tools of your browser (you'll need to install an extension first).
Most of the sites we build for our clients contain some sort of contact form. For those client such forms are potentially critical to their business. Imagine for instance a real estate firm that generates leads with such forms. In most cases we will store the submitted values in the db and mail them…
To convert html to a pdf or an image using wkhtmltopdf and wkhtmltoimage tends to be the popular option. Unfortunately those tools contain an outdated browser engine to do their thing, so you can't use any newish css syntax. A while ago Google added a headless mode to Chrome. They've also released a…
Tweet – – twitter.com
? Little details go a long way when styling UI components. Here are a few different ways to style inputs: pic.twitter.com/1D2AYDwi1f
— Steve Schoger (@steveschoger) 18 oktober 2017
Today I accidentally committed a multi GB file to the git repo of the project I was working on and pushed it. Damn! Because of that big file cloning the repo again would take a long long time. Removing the file locally and pushing again would not solve the problem as that big file is in Git's history.
So I took a few moments to Google around and learned that that there actually is a git command that can rewrite history: filter-branch
. This is how I removed that big file from history:
git filter-branch --tree-filter 'rm path/to/your/bigfile' HEAD
git push origin master --force
Both commands took a while to complete, but after that I had a light repo again.
If you need to do this, be sure to keep a copy of your repo around in case something goes wrong.
Here's an old, but still seemingly still correct blogpost by Dalibor Nasevic with some more info on the subject.
Few weeks ago I froze gems on my blog and ended up with a very big repository. So, I wanted to clean up the mess and remove permanently gems folder from the repository. git rm wasn't doing the job well, it only removes the folder from the working tree and the repository still contains the objects of this folder. After a quick search, I found that git-filter-branch was the command I was looking for.
https://dalibornasevic.com/posts/2-permanently-remove-files-and-folders-from-a-git-repository
Chris Fidao has created an easy to handle, well documented, Docker dev environment for Laravel projects. It's an excellent starting point if you want to have a taste of what Docker can do.
For the introductory newsletter:
I like Vessel the best for the following reasons: 1. It's installed per-project instead of globally. This lets me customize it per project if need be. 2. Docker lets me change out versions of software such as Nginx, MySQL, Redis, and others very easily. (I've often needed to use an older MySQL version at work) 3. Docker lets me add extra software (perhaps Beanstalkd for queues, or PgSQL for database) really easily 4. Docker containers are more like processes than VMs. They generally only use what resources they need (with some caveats, but even with those, they're lighter than Vagrant virtual machines) 5. I can fill up my workstation with one technology (Docker!) instead of many (PHP, Redis, MySQL, etc) with all their configuration files and data strewn about all over my file system 6. You can expand on your dev workflow to build up to a production workflow using all the same technology (Docker!) - You can check out Shipping Docker for my full course on bringing Docker from dev into production.
In a fantastic post on his blog, Kent C. Dodds makes the case for focusing on writing integration tests, and stop going for 100% code coverage. Amen to that!
You may also find yourself testing implementation details just so you can make sure you get that one line of code that’s hard to reproduce in a test environment. You really want to avoid testing implementation details because it doesn’t give you very much confidence that your application is working and it slows you down when refactoring. You should very rarely have to change tests when you refactor code.
https://blog.kentcdodds.com/write-tests-not-too-many-mostly-integration-5e8c7fff591c
The maintainers of Vue.js have recently published their official style guide.
This is the official style guide for Vue-specific code. If you use Vue in a project, it’s a great reference to avoid errors, bikeshedding, and anti-patterns. However, we don’t believe that any style guide is ideal for all teams or projects, so mindful deviations are encouraged based on past experience, the surrounding tech stack, and personal values.For the most part, we also avoid suggestions about JavaScript or HTML in general. We don’t mind whether you use semicolons or trailing commas. We don’t mind whether your HTML uses single-quotes or double-quotes for attribute values. Some exceptions will exist however, where we’ve found that a particular pattern is helpful in the context of Vue.
https://vuejs.org/v2/style-guide/
Want to see some more style guides? At Spatie we have a guidelines site containing styleguides for Laravel and JavaScript.
This site contains a set of guidelines we use to bring our projects to a good end. We decided to document our workflow because consistency is one of the most valuable traits of maintainable software.The contents of this site exist for ourselves—more importantly, our future selves—and for giving future collegues a reference to our way of doing things and their quirks. The guidelines cover workflow, code style, and other little things we consider worth documenting.
Tweet – – twitter.com
Need to mock a specific method in a facade, leaving the remainder free to respond to calls normally? It's possible with "Partial Mocks". pic.twitter.com/VgVMdnBDid
— Raul (@rcubitto) October 4, 2017
At last years Istanbul Tech Talks conference Kevelin Henney gave this great talk on how to improve the readability of your code.
Here are the slides of this talk.
In a post on his Medium blog Cameron Nokes explains the two most important processes in any Electron app: the main process and the renderer process.
Central to Electron is the concept of two or more operating system level processes running concurrently — the “main” and “renderer” processes. Dealing with multiple processes is new territory if you’re coming from browser Javascript land. It was definitely a paradigm shift for me initially, and working with multiple processes may mean you make different design choices in your app that you wouldn’t otherwise.
https://medium.com/@ccnokes/deep-dive-into-electrons-main-and-renderer-processes-7a9599d5c9e2
In a short video posted on YouTube, Shawn McCool explains how you can quickly build an event sourced featured with Commanded.
On his blog Mathias Bynens explains the differences under the hood between async/await and vanilla promises.
The fundamental difference between await and vanilla promises is that await X() suspends execution of the current function, while promise.then(X) continues execution of the current function after adding the X call to the callback chain. In the context of stack traces, this difference is pretty significant. ... Enable JavaScript engines to handle stack traces in a more performant and memory-efficient manner by following these recommendations:
- Prefer async/await over desugared promises.
- Use babel-preset-env to avoid transpiling async/await unnecessarily. ...
In the project I'm currently working on I had to integrate Stripe webhooks. Stripe has great documentation on how to handle webhooks, but it still took a fair amount of time to get the integration just right. My solution for handling webhooks is pretty generic and reusable by others. I decided to…
Tweet – – twitter.com
⚡️. @laravelphp rescue() helper : Catch a potential exception and return a default value #laravel 5.5.3 pic.twitter.com/Y8bRlx1gUc
— Jeff (@Jeffer_8a) September 8, 2017
Tweet – – twitter.com
? Tip of the Day
— Jacob Bennett (@JacobBennett) September 26, 2017
Press T while in a Github Pull Request to get a fuzzy search for all changed files. ? pic.twitter.com/LOQsJ9z0vZ