Stoimen Popov advises not to call __destruct() manually.
The important thing to note is that you shouldn’t call the destructor of an object explicitly! Not because it will throw an fatal error, but simply because it won’t destroy the object.
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 publishes a super resourceful and practical newsletter. A must for anyone in the Laravel space"
Bill Jordan wrote an absolutely amazing piece on the things he learned in the twenty-eight years he worked in the software industry. There are so many good insights that I can nearly quote the entire article.
Here are some of the things that resonated with me:
Odds are far better than good that your high performers are achieving what appears to be high levels of productivity by building technical debt into the application by taking shortcuts whether intentionally or unintentionally. These kinds of high performers are actually low performers when when TCO is factored in.
Encourage developers to improve the application while working on their projects. Examples of improvements are creating reusable objects out of copypasta code and breaking up large objects that are difficult to maintain into smaller objects that individually are easier to reason about. Improve the database schema even if it hurts in the short term. Delete old and unused code. With the benefit of hindsight update the user interface to improve user experience — sometimes even just changing a word or two makes a big difference.
When continual improvement is part of the DNA of your team you’ll be amazed with the results, but give those results some time to become apparent — it won’t happen overnight. It also means management will need to recognize that things will take more time since developers will be working on their primary project while simultaneously making incremental improvements.
One of our more popular packages is laravel-analytics. The package makes it easy to fetch information such as pageviews, top referrers, etc... from the Google Analytics API. In our Blender-based projects we use the fetched data to display a nice chart in the admin section: Laravel-analytics is one…
In a new tutorial posted at dotdev.coDiaa Fares shows a good way to develop API's using Laravel. Along the way he touches on the Dingo packages, JSON Web tokens and documentation generation.
Let’s look at everything we will cover:
Landmark 1: Prepare our TDD environment and creating our first test.
Landmark 2: Installing and configuring Dingo API package.
Landmark 3: What are Transformers, why the need for them and how to use thephpleague/fractal as our transformation layer.
Landmark 4: Introduction about JWT and how to use tymondesigns/jwt-auth for our token based authentication.
Landmark 5: How to use laravel-apidoc-generator to generate nice documentation for our API.
So, pack your bags and let’s dive into our journey!
In this talk Sam Bellen demonstrates how to use JavaScript's web-audio-api to transform audio in realtime. Presentations with guitars are cool. Love the Metz t-shirt.
Sandi Metz solved the Roman numerals kata in a very interesting way. Along the way she makes the case for keeping code simple.
The desire for simplicity means that I abhor special cases. I am willing to trade CPU cycles to achieve sameness. I'll happily perform unnecessary operations on objects that are already perfectly okay if that lets me treat them interchangeably. Code is read many more times that it is written, and computers are fast. This trade is a bargain that I'll take every time.
Lately I've been working a lot with collections in Laravel. If you're not in the know: a collection is a sort of super charged array with a lot of powerful functions to transform the data inside it. The only thing I found a bit of a hassle is how to debug the various steps in a collection chain.…
Davey Shafik dissects the values of several tech communities in a new post on his blog.
Just like the programming languages that are the centers of our communities, each community has its own set of rules and idioms — they have a real life syntax.
In my (almost) three years of being in a developer relations type role I have attended events in several communities and have observed how they differ from my primary community (PHP). As I’ve tried to understand those differences and the reasons behind them, I have had many discussions with members of many more communities also.
After attending my first PyCon (US) I was struck by just how welcoming and diverse the community is and had many conversations trying to understand why this is. This is not what this post is about. This post is about conferences specifically, and how communities place different priorities on different things when it comes to how they run, organize, speak at, and attend events.
On his blog Chris White explains how to upload files directly to S3. Pretty cool!
Most of us know of Amazon S3, a cloud based storage service designed to store an unlimited amount of data in a redundant and highly available way. For most situations using S3 is a no brainer, but the majority of developers transfer their user's uploads to S3 after they have received them on the server side. This doesn't have to be the case, your user's web browser can send the file directly to an S3 bucket. You don't even have to open the bucket up to the public. Signed upload URLs with an expiry will allow temporary access to upload a single object.
Over at the excellent dotdev.co Amo Chohan wrote an article on how to structure code when you need many filters on an Eloquent model.
I recently needed to implement a search feature in an events management project I was building. What begun as a few simple options (searching by name, e-mail etc), turned into a pretty large set of parameters.
Today, I’ll go over the process I went through and how I built a flexible and scalable search system. For those of you who are eager to see the final code, head over to the Git repository to see the code.
At Spatie we have a tv screen against the wall that displays a dashboard. This dashboard displays the tasks our team should be working on, important events in the near future, which music is playing at our office, and so on. Here's what it looks like: We've opensourced our dashboard, so you can view…
The grid layout for dashboard.spatie.be was conceived with 3 simple ideas in mind: The layout has to be lightweight on the client side: no JavaScript calculations or full-blown grid library should be used. The HTML structure in the templates has to be clean, without extra markup for rows and…
The release of Laravel 5.3 is just around the corner. Over at Laravel News Eric L. Barnes made a nice overview of the new stuff coming in the framework.
Laravel 5.3 is currently in development and with all new Laravel releases, new features are being teased out as they are added. Here is a quick look at some of these new features.
A few weeks ago the Frontend United Conference was held in Ghent, Belgium. The entire development team at Spatie attended the conference. Though it certainly was fun to go to a conference with the entire team we were left a bit underwhelmed. Some of the talks were very short and some speakers seemed a bit unprepared.
The organisers have begun posting video's of all sessions to YouTube. In my opinion the following three talks rose above the rest.
1: Harry Roberts gave a talk were he demonstrated that programming best practices apply to writing CSS as well.
2: Christian Heillman talked about web obesity and gave a few tips on how to optimize the size of images.
3: Mathias Bynens showed how unicode support in JavaScript is broken and what common pitfalls are when working with special characters. Rather than just complaining about it, he offered some kick ass self-made solutions.
(the video for this session hasn't been posted yet, this is a video of the same talk at another conference)
Today we released our new package called laravel-blade-javascript. It provides you with a javascript Blade directive to export PHP variables to JavaScript. So it basically does the same as Jeffrey Way's popular PHP-Vars-To-Js-Transformer package but instead of exporting variables in the controller…
Splitting your Rails controllers when they have a very specific scope, too much logic, or too many mixed concerns can have a lot of good side effects in your code.
It doesn’t mean that you never abstract. It just comes later down the road. At some point some logic needs to be shared by several controllers. Sometimes even a splitted controller with only one public method gets too big. Et cetera. This is where concerns, model methods, possibly background jobs, and even sometimes service objects (hopefully not too many) come into play.
The more your app grows, the more time you will need to spend to understand it, no matter how clean the code is. But splitting your controllers makes things easier.
Apart from simplicity, another advantage of using process substitution is Bash will automatically parallelize your tasks. Returning to our first example…
A few observations: 5.3 dropped to almost nothing which is great news! 5.4 is also down by almost 10% and is definitely on the way out. 5.5 is still big but less so, while 5.6 got a huge boost to become the main version. The big surprise is that we have 20% of PHP7 already! That is great news only six months after this major release came out.
20% sounds really great, but I suspect that this number is slightly optimistic. Many developers who are running PHP 7 in their dev environment use PHP 5.X in production.
Over on the package side only ±20% of all packages require PHP 5.5 or above and only 1% requires PHP 7. Jordi has this to say about that:
All in all, it seems like package requires are way behind actual version usage, so I would like to encourage everyone to be a bit more aggressive in bumping PHP requirements when tagging new major releases of their libs.
That's great advice. The bulk of the newly released Spatie packages require PHP 7. In my opinion you'd do our ecosystem a favour by picking PHP 7 as a minimum requirement when you are creating a new package.
Matt Stauffer has been working on a book titled "Laravel: Up and Running" which will be released soon. In a post on his blog Matt shares a few hidden Laravel gems that he discovered while writing his book.
No blog post could contain all of the new things I learned from writing this book. I've been using—and teaching about—Laravel for years, and I was still shocked by how many tools and helpers and features I discovered.
Here are a few that stand out to me that I had never seen prior to writing the book.