A handy eloquent macro to compare dates
⏲️ Handy eloquent macro for the date comparison impaired ? pic.twitter.com/rUgLlEywrn
— Caleb Porzio (@calebporzio) April 25, 2018
Read more [twitter.com]
⏲️ Handy eloquent macro for the date comparison impaired ? pic.twitter.com/rUgLlEywrn
— Caleb Porzio (@calebporzio) April 25, 2018
Read more [twitter.com]
If you want to quickly inspect a return value, you can use tap + logger without adding a variable! #laravel pic.twitter.com/TXA02BYlaC
— Sebastian De Deyne (@sebdedeyne) April 27, 2018
Read more [twitter.com]
Join 9,500+ smart developers
Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.
No spam. Unsubscribe anytime. You can also follow me on X.
"Freek’s newsletter is one of the best ways to stay updated with the Laravel and PHP ecosystem. It consistently highlights useful packages, tools, and ideas from the community, especially the amazing work coming from Spatie. As a Laravel developer building SaaS and web platforms, I find it extremely helpful to discover practical tools and insights that improve my development workflow."
In a new post on his Medium Blog, Laravel.io maintainer Dries Vints wrote how he managed do drastically improved the build time of the popular forum.
CircleCI 2.0’s builds run with Docker which makes spinning up new instances super fast. If you use pre-built images which are customized to your needs, you don’t even need to do any provisioning during the build which saves you quite a bit time. Pulling various images and orchestrating them in a CircleCI 2.0 config allows for very rapid build times. If you add their new workflows to their mix you could easily enable parallelization and speed things up even more.
https://medium.com/laravelio/how-circleci-improved-our-build-time-8d5c40b8cc60
Most of the UI in my sideproject Oh Dear! is realtime. Because there is a vast amout of events being broadcasted using Pusher would be too expensive at this stage. So for our broadcasting we use socket.io and laravel-echo-server mentioned in the article below.
I had this challenge where I needed it to show a list of people who are currently viewing a specific URL in Laravel. So I started thinking. Part of me wanted to do a quick hack (luckily that’s not the strongest side of mine), whilst the other wanted to build something cool, reusable and long-lasting.
https://medium.com/@adnanxteam/how-to-use-laravel-with-socket-io-e7c7565cc19d
Michael Dyrynda, co-host of the Laravel News and North Meets South podcasts shares his knowledge on how to handle applications that share one or more databases.
It took me a couple of months to get this to a working state, so I hope that I'm able to save you some time should you find yourself in my shoes at some point in the future!
https://dyrynda.com.au/blog/sharing-databases-between-laravel-applications
Over at Laravel News Paul Redmond, author of Docker for PHP developers, wrote a good post on how to use our RSS package to add a feed to a Laravel app.
Creating an RSS feed in Laravel isn’t the most challenging task, but using a package and a few tips can help you create an RSS feed relatively quick.
We are going to use the spatie/laravel-feed package to walk through going from a brand new Laravel 5.6 project to serving RSS feeds.
https://laravel-news.com/learn-to-create-an-rss-feeds-from-scratch-in-laravel
? Handy lil testing macro for getting data from views pic.twitter.com/50dn2jCfSy
— Caleb Porzio (@calebporzio) March 30, 2018
Read more [twitter.com]
? Quick Tip for @laravelphp: It's easy to show Horizon metrics somewhere else. pic.twitter.com/SIUfwfAsKX
— hans ? (@hanspagel) March 27, 2018
Read more [twitter.com]
Over at Laravel News Povilas Korop wrote a nice tutorial on how to use our medialibrary (we released a new major version a couple of days ago).
By default, the Laravel registration form contains only the name, email, and password, but often it’s useful to allow the user to upload a photo or an avatar. In this tutorial we will show you an easy way to add it, using Spatie’s Media Library package.
https://laravel-news.com/uploading-avatar-images
It's a good tutorial but there's a few things not mentioned. At the end of the post you'll see this line of code:
Auth::user()->getMedia('avatars')->first()->getUrl('thumb');
That can be written a bit shorter as :
Auth::user()->getFirstMediaUrl('avatars', 'thumb');
The new v7 of the medialibrary has a new feature called "single file collections", which is just perfect for this example. Take a look at the docs: https://docs.spatie.be/laravel-medialibrary/v7/working-with-media-collections/defining-media-collections#single-file-collections
laravel-medialibrary is a powerful package that can help handle media in a Laravel application. It can organise your files across multiple filesystems, generate thumbnails, optimize images and much much more. At Spatie we use this package in nearly every project. The last few months our team has…
#30daysWithEloquent customize relations on your models as necessary in your domain. Don't be afraid to add more relations that describe your logic better.
— DRY, DRY, DRY, DRY (@SOFTonSOFA) February 22, 2018
With @laravelphp it's a cinch ??? pic.twitter.com/m3TJXp9C2l
Read more [twitter.com]
In case you have a one off section of code where you don't want to change the timestamps on save. #laraveltips pic.twitter.com/1XMwNwQNIz
— Eric L. Barnes (@ericlbarnes) March 11, 2018
Read more [twitter.com]
Last week Laravel Excel v3 was released. In a post on his company blog Patrick Brouwers writes the story of why and how v3 was released.
Laravel Excel (https://github.com/Maatwebsite/Laravel-Excel) turned 4 years last November and has reached almost 6 million Packagist downloads. A good time to reflect on 4,5 years of open source development.
https://medium.com/@maatwebsite/laravel-excel-lessons-learned-7fee2812551
My colleague Seb did some amazing work with the creation of two packages that make it easy to get started with server side rendering in PHP. In a new post on his blog he'll tell you all about it.
Server side rendering is a hot topic when it comes to client side applications. Unfortunately, it's not an easy thing to do, especially if you're not building things in a Node.js environment.
I published two libraries to enable server side rendering JavaScript from PHP: spatie/server-side-rendering and spatie/laravel-server-side-rendering for Laravel apps.
Let's review some server side rendering concepts, benefits and tradeoffs, and build a server renderer in PHP from first principles.
https://sebastiandedeyne.com/posts/2018/server-side-rendering-javascript-from-php
For the past few years Spatie, the company where I work, has released many Laravel and PHP packages. Those packages are primarily built to be used in our own projects. We do not operate in a void. We have a community around us. They use our work. They help to make our packages better by submitting…
Our team is currently prepping a new version of our medialibrary. One of the highlights is support for responsive images. On his blog my colleague Brent explains what it entails and why it is important.
I want to share some thoughts on responsive images. I'll write about a certain mindset which many projects could benefit from: small- and mid-sized web projects that don't need a full blown CDN setup, but would enjoy the performance gain of responsive images.
https://www.stitcher.io/blog/responsive-images-done-right
Blade components are pretty cool for scoped-slot-like stuff when you're not in a JS environment pic.twitter.com/pjp4ycOPKm
— Sebastian De Deyne (@sebdedeyne) March 2, 2018
Read more [twitter.com]
When the db structure changes, it's sometimes easy to perform the data migration inside a database migration.
— Freek Van der Herten (@freekmurze) February 24, 2018
Migration 1: do the db migration + restructure the data
Migration 2: drop the old columns
I'd only do this for simple stuff. pic.twitter.com/v2roA6OxBc
Read more [twitter.com]
By default all scripts on a webpage are allowed to send and fetch data from and to any site they want. If you think about it, that's kinda scary. Imagine that one of your JavaScript dependencies would send all keystrokes, including passwords, to a third party website. That would be pretty bad. In…