Open-sourcing our guidelines

At Spatie we recently launched a new site: guidelines.spatie.be. It contains articles on how we go about setting things up at Spatie and a collection of styleguides. The source code of the site is available on GitHub. In this blogpost I’d like to share why and how we created our guidelines site. Why did we […]

Continue reading →

Use your Laravel named routes in JavaScript

Daniel Coulbourne, an engineer at Tighten Co and co-host of the amazing Twenty Percent Time podcast, recently released Ziggy, a tool to share your Laravel named routes with JavaScript. Ziggy creates a Blade directive which you can include in your views. This will export a JavaScript object of your application’s named routes, keyed by their […]

Continue reading →

Cruddy by design

At this year’s Laracon US Adam Wathan gave a talk titled “Cruddy By Design” on how to structure your controllers better. After the conference he published a new GitHub repo that contains the demo app he refactored on stage. The 4 main tips to improve your code come as PRs on the repo with a […]

Continue reading →

Diving into Laravel Horizon

Laravel Horizon is a kickass dashboard for viewing queued jobs. Co-creator Mohammed Said published two posts about the inner working of the tool. The first one on the Diving Laravel site highlights the overall configuration and how the master supervisor works. Laravel Horizon is a queue manager that gives you full control over your queues, […]

Continue reading →

A recap of Laracon US 2017

Laracon US 2017 was an amazing conference. Sid published this excellent recap that contains many links to slides and related content. I attended my first Laracon in person and I have to say I really enjoyed the experience — maybe more than I expected to. It was well organised and the talks were diverse, informative and actionable. […]

Continue reading →

Optimize images in Laravel apps

A while ago we released image-optimizer. In short this package can make all kinds of images smaller by stripping out metadata and applying a little bit of compression. Read this blogpost to learn more about it. Although it’s pretty easy to work with the package, we felt that we could deliver a more seamless experience […]

Continue reading →

Combining query scopes with explicit model names

🔥Combining query scopes with explicit model names will help keep code cleaner and easier to understand #laravel pic.twitter.com/ixzDdrZcRT — Chris Gmyr (@cmgmyr) July 12, 2017 Freek Van der Herten Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he […]

Continue reading →

Determining the owner of a model

I love this little “owns” trait/method that @michaeldyrynda & I came up with for Confomo. Look at that expressiveness. :kisses fingers: pic.twitter.com/dE731Ko1Zw — Matt Stauffer (@stauffermatt) July 7, 2017 Freek Van der Herten Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with […]

Continue reading →

Testing uploads in Laravel

Testing @spatie_be 's media library with the new #laravel upload fakes 👍 Trust, but verify 😅 #testing pic.twitter.com/Ss98rGloRf — Christoph Rumpel (@christophrumpel) July 3, 2017 Freek Van der Herten Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he […]

Continue reading →

Easily optimize images using PHP (and some binaries)

Our recently released image-optimizer package can shave off some kilobyes of PNGs, JPGs, SVGs and GIFs by running them through a chain of various image optimization tools. In this blog post I’ll tell you all about it. First, here’s a quick example on how you can use it: use Spatie\ImageOptimizer\OptimizerChainFactory; $optimizerChain = OptimizerChainFactory::create(); $optimizerChain->optimize($pathToImage); The […]

Continue reading →

Insights into Laravel package design

On the Bugsnag blog, Graham Campbell, wrote a guest post on the basics of creating a Laravel package. If you’ve ever wanted to create a package, this is a good starting point. Laravel is a massively influential PHP framework, and its simple but powerful design means that it’s easy to utilize packages in your application. […]

Continue reading →

Go crazy with Blade directives

🔥 Go crazy with Blade directives. The simplest things can abstract away tons of visual noise from your templates. pic.twitter.com/p5udGWJkhd — David Hemphill (@davidhemphill) June 22, 2017 Freek Van der Herten Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After […]

Continue reading →

Comparing model collections

Cool little Laravel 5.5 Eloquent Collection macro to assert two model collections are the same 🤙🏻 pic.twitter.com/zzbkr1fL9T — Adam Wathan (@adamwathan) June 14, 2017 Freek Van der Herten Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes […]

Continue reading →

Using request()->query()

On Twitter I see a bunch of people regularly tweeting very nice code snippets. Instead of only retweeting those, I’m going to add them to my blog. I’ll tag them with tweet. Here’s the first one: request()->query() is a life saver when dealing with tables that store "sorts" and "filters" in a query string. pic.twitter.com/84P6xvTvSz […]

Continue reading →

Performant Laravel

Chris Fideo, of Servers For Hackers and Shipping Docker, published a new free video serious on optimizing performance for Laravel apps. He shows how to use the built in artisan commands such as config:cache and route:cache,how to optimize queries, build up good indexes and how to add an object cache in a clean way. There […]

Continue reading →