A weekly Laravel newsletter, with a lot of tutorials, as usual. Enjoy!
From my Youtube Channel
Everything about Laravel Move to Vite
Migrating from Laravel Mix to Vite
Laravel's default asset bundler is about to switch from Laravel Mix (Webpack) to a wrapper around Vite. I've had a crack at migrating over early starting with some older apps that still use Vue with inline templates and Sass.
Moving A Laravel Webpack Project To Vite
Vite is the Next Generation Frontend Tooling, which is Laravel's default from now on. The Laravel documentation contains an entire section explaining how it works and how to use it. But most of us are more interested in using it in an existing project. So that's what this post is for.
Making Vite and Valet play nice together
Yesterday, the Laravel team launched the official vite-plugin. From now on, Vite will be the standard build tool for Laravel. The main benefits are vastly improved build times and a more straightforward API. Want to know more about it? Head over to the official docs.
From Laravel Community
Artisan commands vs zsh
If you are a user of zsh and you want to make it easier to use artisan commands, then just install the zsh-artisan plugin. Installation instructions can be found here.
This package makes your endpoints idempotent easily. Check out this Stripe Blog Post about Idempotency.
Eloquent Attribute Casting
Eloquent Castable attributes are one of the more powerful features of Laravel; some people use them religiously while others tend to shy away from them. In this tutorial, I will walk through a few different examples of using them and, most importantly, why you should be using them.
How to Add Laravel Pint to VS Code Formatter
Mohammed Samgan Khan ~ 138 views What is laravel pint as in the defination by the official repository, Laravel Pint is an opinionated PHP code style fixer for minimalists. Pint is built on top of PHP-CS-Fixer and makes it simple to ensure that your code style stays clean and consistent.
How to Break Down Laravel Unit Tests into Types
What’s the difference between unit test, integration test, and a feature test? Which should you use for what type of test? Is it just preference or does performance factor in when using Laravel? Let me give you my take from over a decade of unit testing experience.
Laravel Sail plugin to enable SSL (HTTPS) connection with Nginx. You need to setup Laravel Sail environment before using the plugin.
Interfaces binding with implementations in Laravel
An interface is a programming structure that allows the computer to enforce certain properties on an object. In object oriented programming, an interface generally defines the set of methods that an instance of a class that has that interface could respond to.
Macros in Laravel
Laravel's Illuminate\Support\Macroable trait allows you extend classes at runtime with custom methods. The idea is that you provide a named Closure, or callable value, which can then be invoked using PHP's __call() and __callStatic() magic methods.
Using console routes in Laravel
Today, I want to talk about a lesser known feature in Laravel which is console routes. Often, you have console commands which need to run one after the other (especially if you don't want to create one big command).
Is Laravel Livewire SEO friendly?
Laravel Livewire is on the hype recently. It promises to use the same stack on the backend and frontend with Laravel. By using Livewire, you can create dynamic interfaces like with Vue.js or React. Because, at the end of the day, not everybody has the aspiration for front-end development.
Easy multi-tenancy with Laravel
The first version of Teleatherapy was single-tenant, meaning all the resources in the database belonged to one “organisation”, us. This was fine for an early version of the product to get us up and running.
Detecting slow database operations in Laravel 9.x
When working with databases with web applications, you never know when some query, which used to work fine, starts slowing down in some scenarios. For instance, in a scenario where the indexing is not done properly or the data being inflated to some table has gotten overwhelmingly large.
Using this package, you can cache your heavy and most used queries. All you have to do is to define the CacheEntity objects in the model and specify a valid name and ttl for them.
Vapor: Understanding Concurrency
Every application running on Vapor is powered by AWS Lambda, which allows us to run code without needing to think about servers. One of the biggest benefits of this type of infrastructure is that it allows our applications to automatically scale to meet demand with little to no capacity planning.
That's it for this week, see you in the next newsletter issue!