Introduction
Welcome to the second issue of new series! At the end of each month, I aim to write a round up of the some of the month's news from the Laravel and web development community.
If you haven't read last month's issue, you can read Round Up: January 2022.
This month, we have a new major Laravel version upgrade, Laracon Online, and a lot of cool new platforms/services released.
Laracon Online
Towards the beginning of the month, we had Laracon Online Winter 22. The day was filled with loads of really cool talks. I don't think there was a single talk that I watched where I didn't learn at least one new thing.
One of the best parts of Laracon Online this year is that it was completely free to watch online. In fact, the entire day's talks are all still online for you to watch on YouTube right (in the video below). So, if you didn't get chance to watch it or maybe missed a few talks, you can catch up on them.
Laravel 9 Released
Another huge piece of news from February is that Laravel 9 was officially released. There's a huge amount of new features that have been released, as well as the minimum PHP version being bumped to PHP 8.0. The website also received a refresh and switched to using Torchlight (by Aaron Francis) for the code highlighting in the documentation.
For a full list of all the new changes, you can check out the release notes for Laravel 9. Here's a quick rundown of a few of my favourite additions added in this release:
Route Binding with Enums
You can now use enums for route binding in your routes. For example, let's say you have the following enum:
1enum Status: string2{3 case Paid = 'paid';4 case Overdue = 'overdue';5 case Draft = 'draft';6}
You can then use this enum in your routes so that you can pass it into your queries:
1Route::get('/invoices/{status}', function (Status $status) {2 return $status->value;3});
Shorter Syntax for Slot Names
There's also a shorter syntax that you can use in your Blade components when using named slots. For example, in the past you would invoke a component like so:
1<x-modal>2 <x-slot name="trigger">3 // ...4 </x-slot>5 // ...6</x-modal>
Now, as of Laravel 9, you can use your components like so instead:
1<x-modal>2 <x-slot:trigger>3 // ...4 </x-slot>5 // ...6</x-modal>
Checked and Selected Blade Directives
As of Laravel 9, there are now two new Blade directives (@checked
and @selected
). These can be used to add the "checked" and "selected" attributes to your checkbox
and select
HTML elements when rendering a page.
This is one feature that I'm particularly excited to be using because I helped contribute to getting the @checked
directive added. I originally made the pull request to Laravel 8; however, Taylor Otwell closed it and decided to add the feature to Laravel 9 to prevent any conflicts with anyone who might have already added these directives to their own projects.
Here's a quick example from the documentation of how you may want to use the @checked
directive:
1<input type="checkbox"2 name="active"3 value="active"4 @checked(old('active', $user->active)) />
Likewise, the @selected
directive may be used to indicate if a given select option should be "selected":
1<select name="version">2 @foreach ($product->versions as $version)3 <option value="{{ $version }}" @selected(old('version') == $version)>4 {{ $version }}5 </option>6 @endforeach7</select>
Checkmango
During this month, James Brooks announced a cool new A/B testing platform called Checkmango.
If you're not familiar with A/B testing tools, Optimizely gives a pretty good explanation: "A/B testing (also known as split testing or bucket testing) is a method of comparing two versions of a webpage or app against each other to determine which one performs better. A/B testing is essentially an experiment where two or more variants of a page are shown to users at random, and statistical analysis is used to determine which variation performs better for a given conversion goal.".
If you're using Checkmango in your Laravel applications, you can test your different page designs and call to actions to see which one converts your customers better. So, it could be an extremely useful tool if you want to make the most out of your sites and make more money from them.
As the examples show on the Checkmango landing page, in your PHP code, you can perform different actions depending for each user depending on which "variant" they've been assigned by your site/application:
1use Checkmango\Client; 2 3$client = new Client(); 4$client->authenticate('API_TOKEN'); 5 6$variant = $client->teams(1) 7 ->experiments() 8 ->enrol('MY_EXPERIMENT', 'PARTICIPANT_KEY'); 9 10if ($variant == 'VARIANT_A') {11 // Show variant A12} elseif ($variant === 'VARIANT_B') {13 // Show variant B14} else {15 // Show a default variant16}
Likewise, you can also use the Blade directives that will be provided by the Laravel client so that you can conditionally build your views depending on the user's "variant":
1@experiment('PARTICIPANT_KEY', 'MY_EXPERIMENT')2 @variant('VARIANT_A')3 Show big hero4 @elsevariant('VARIANT_B')5 Show half hero6 @else7 Show whatever we have by default8 @endvariant9@endexperiment
At the moment, Checkmango is in a private beta. But if you're interested in subscribing so that you can be notified when it's officially released, you can head on over to the Checkmango site to register.
Awesome Releases
New Tailwind Components
During February, Tailwind UI released 3 new categories of components: Calendars, Command Palettes, and Comboboxes. I've already been able to make use of one of the Comboboxes in one of my own projects. I was really happy with how it just dropped in to my project's view without needing many changes. If you haven't already seen them, I'd definitely recommend checking them out.
Boardy
There was also a new platform released by Kai Sassnowski called Boardy. Boardy is an online service that lets you build your own dashboards using modules. For example, you can build a dashboard that you can then set as your landing page whenever you open your browser.
I signed up for a free trial on Boardy and was amazed at how easy it was to set up and build my own dashboard. You can select modules from a list and simply add them to your dashboard to customise it. There are also some modules that integrate with third-party services such as GitHub, Fathom Analytics, Oh Dear and Todoist to make your dashboard more information-rich.
I'd recommend heading on over Boardy and at least signing up for a free trial to see if something that you might like.
Font Awesome 6
Font Awesome 6 released during February with a huge amount of updates for their icons. This newest release now includes 7,000 new icons, which come in "solid", "regular", "light", "duotone", and the new "thin" style. This means that there are now over 1,700 free and open-source icons, as well as a total of over 14,000 icons for Font Awesome 6 Pro users.
Head on over to the Font Awesome website to see the latest changes and all of the new icons they've added.
My News
For myself, February wasn't an overly exciting month for web development. I used the time to do some housekeeping so that I can be better positioned to release more content this year and give my website a much needed refresh.
Switched to Torchlight
Towards the beginning of the month, I switched over from highlight.js to using Torchlight for my blog posts' code highlighting. Don't get me wrong, highlight.js is a really good library and has been working well on my site for the last few years. However, the lack of proper Blade and Laravel-specific highlighting was always something that I wished I had.
So, after seeing Aaron Francis talking about Torchlight on Twitter, I made the jump and switched over to using it. I was expecting the switch to be tedious and a pain, but by using the Torchlight Laravel client package, I was up and running in a couple of minutes. There wasn't really any messing around... it just worked!
If you're needing to add code highlighting to your site or application, Torchlight would definitely be worth checking out. There's even a free tier that you may be able to use depending on your project.
Updated Blog to Laravel 9 and PHP 8.1
During February, I decided to update my website to use Laravel 9 and PHP 8.1. Apart from writing new blog posts and articles, I quite often forget to keep my website up to date. It usually takes a back seat when I'm working on client or open source projects. But, at the end of January, I decided that after the Laravel 9 release that I was going to make sure my site's Composer dependencies and PHP versions were fully up to date.
This should hopefully take a lot of stress off my shoulders, so that later this year I can refresh the site without needing to worry about technical debt.
Mango Two Closer to Release
If you read my round up for January 2022, you'll know that I've been working on a small Chrome browser extension called Mango Two. I've been working on it just so that I can try and skill-up in JavaScript/TypeScript and also to have a fun little project that has no commercial purpose.
I've only been working on it for the odd hour or two during February. But, I'm pretty excited, because I think it should be at a stage now where I can get it added to the Chrome Web Store for downloading as a browser extension. I've also been working on a landing page for the project and I'll be hoping to release that at some point during March.
I'll make sure to put a small Quickfire blog post together once it's released to show you what the extension can be used for.
Mentions on Laravel News Podcast
This is something that I'm quite proud of actually but doesn't necessarily fit into my news for February. During February, I've been catching up on the Laravel News podcast because I'd fallen behind on a few episodes and wanted to keep up to date.
While listening to the podcast, I realised that I'd been mentioned 4 times on them and I never actually knew! So, as you can imagine this was a really exciting moment for me when I realised.
One of the podcast episodes mentioned a feature that I contributed to the Laravel framework that allows you to add extra default validation rules (PR: #40137):
Another episode mentioned the feature that I contributed to the framework that allows you to define the logic for building temporary URLs for your storage:
As a side note, this feature has already come in handy and it was used by Taylor Otwell (PR: #41113) to create a nice solution for an issue that was created way back in 2017 (issue: #21773).
Another episode mentioned my proof-of-concept TypeSafe package that I created and my Using Semantic Elements to Improve Your HTML blog post that I published on my blog:
My PRs
During February, I didn't really spend a lot of time making any open source contributions. However, I did manage to make 2 really small PRs to the Laravel framework and Showcode:
-
laravel/framework
- Removed unused local variables (#41224)
-
stevebauman/showcode
- Updated error message (#100)
Laravel Releases
As well as Laravel 9.0.0 being released in February, there were also 8 other Laravel versions that were tagged and released during the month: 8.82.0, 8.83.0, 9.0.1, 9.0.2, 8.83.1, 9.1.0, 8.83.2, 9.2.0.
If you're interested in checking out the entire changelog for each of the releases, I recommend checking out the release notes for each one on GitHub. Here are the main additions that were added in the releases:
8.82.0
- Added class and method to create cross joined sequences for factories (#40542)
- Added Transliterate shortcut to the Str helper (#40681)
- Added array_keys validation rule (#40720)
8.83.0
- Add isolation level configuration for Postgres connector (#40767)
- Add a string helper to swap multiple keywords in a string (#40831 & 220f4ac)
8.83.1
- Add firstOr() function to BelongsToMany relation (#40828)
- Catch suppressed deprecation logs (#40942)
- Add doesntContain to higher order proxies (#41034)
8.83.2
- Added support of Bitwise operators in query (#41112)
9.0.1
- Improves
Support\Collection
each method type definition (#40879)
9.0.2
- Add disabled directive (#40900)
9.1.0
- Added the ability to use the uniqueFor method for Jobs (#40974)
- Add filtering of route:list by domain (#40970)
- Added dropForeignIdFor method to match foreignIdFor method (#40950)
- Adds
Str::excerpt
(#41000) - Make:model --morph flag to generate MorphPivot model (#41011)
- Add doesntContain to higher order proxies (#41034)
9.2.0
- Added
Illuminate/Database/Eloquent/Casts/Attribute::make()
(#41014) - Added
Illuminate/Collections/Arr::keyBy()
(#41029) - Added expectsOutputToContain to the PendingCommand. (#40984)
- Added ability to supply HTTP client methods with JsonSerializable instances (#41055)
- Added
Illuminate/Filesystem/AwsS3V3Adapter::getClient()
(#41079) - Added Support for enum in Builder::whereRelation (#41091)
- Added X headers when using Mail::alwaysTo (#41101)
- Added of support Bitwise operators in query ([#41112]https://github.com/laravel/framework/pull/41112)
- Integrate Laravel CORS into framework (#41137)
- Added
Illuminate/Support/Str::betweenFirst()
(#41144) - Allow specifiying custom messages for Rule objects (#41145)
Conclusion
Hopefully, this post should have shown you at least one cool new thing from the web dev world in February 2022.
If you enjoyed reading this post, I'd love to hear about it. Likewise, if you have any feedback to improve the future ones, I'd also love to hear that too.
If you're interested in getting updated each time I publish a new post, feel free to sign up for my newsletter below.
Keep on building awesome stuff! 🚀