19 Ecosystem in Laravel Framework You Must Know - Part 1
This article will shortly introduce the popular useful ecosystems in the Laravel framework you might not know about. As many companies worldwide use Laravel in their projects, and thousands of packages and services are built to support it. In the current ecosystem of laravel, nineteen of them (package) are able to have the honor of being on the list of laravel's official website. Those packages can be categorized as below:
Auth Socialite / Sanctum
Integration Scout / Echo
Administration and Monitoring Nova / Horizon
Development Environments Sail / Valet
Performance Octane
Testing and Debugging Telescope / Dusk
Deployment Forge / Vapor / Envoyer
Frontend and Scaffolding Breeze / Mix / Jetstream / Cashier / Spark
1. Socialite
Let's begin with the package Socialite, we all love single sign-in and often give up on some websites that require filling up forms for account registration. Socialite library provides this feature for laravel with a very easy setup, installing the Socialite library and then configuring the providers that you want (ex. Google) by getting the OAuth credential application from the provider (In this case Google). Finally, coding for two routes, one for directing users to grant permission via Google and another one for redirecting users back to our own project. Once the user grants permission for us to access the basics of their information, we can create users in our own database.
2. Sanctum
Many API-based applications use Bearer Tokens to authenticate users' requests. Laravel Sanctum makes it very easy to create and manage tokens, and also controls the abilities of each token as well. It's as simple as adding HasApiTokens
to the user model and you can now create tokens for users and send them (tokens) back to the front-end. Guarding your protecting routes by the middleware auth:sanctum
. Furthermore, Sanctum also enables the ability to apply for individual actions such as INSERT ONLY or UPDATE ONLY, etc.
Sanctum also supports Single Page Application (SPA) authentication which uses laravel's default sessions and cookies instead of tokens and works on web routes. To figure out more you can check the official documentation here.
3. Scout
Most database full-text indexes are not good enough in practice. If you want fuzzy search capability, services like Algolia, MeiliSearch, or ElasticSearch can help. When you create, save or delete the models; Scout keeps searchable data in sync with the search engine. When you search on your model, Scout queries the search engines for results and fetches matching rows from the database.
4. Echo
Modern web applications utilize Web Socket for live updating user interfaces and push real-time messages to the front-end. In Laravel, it's easy to broadcast events over a broadcasting service like Pusher channels or Ably. Then, the front-end receives the messages in real-time with the help of Laravel Echo which is a javascript library connected to the broadcasting channel vial web socket. The use cases of this setup can be the inform users of delayed tasks, notification of important events, and even creating real-time chat applications.
5. Nova
Developers love creativity but creating admin panels is a painful process, mostly because of coding repetitiveness. Taylor has built a beautiful and customizable admin with Vue JS to get over this headache. It has the most common functionalities with clean documentation like Laravel. Some of the Nova features are putting custom filters on data and even changing underlying eloquent queries with lenses, doing a global search with the help of the Scout package, creating custom themes, etc.
6. Horizon
One of Laravel's great features is the ease to set up queues for processing time-consuming jobs in the background. Horizon provides a beautiful dashboard to monitor and manage your queues in Redis. It also provides metrics to check the workload time for each queued job. You can see the pending, completed, and failed jobs Horizon enables you a convenient way to retry the failed jobs from UI. Developers also can ask Horizon to send notifications when queues have a long wait time.
7. Sail
Sail helps to build a development for the Laravel project inside the docker. Sail contains default docker files for PHP and Node (recent) versions, and docker-compose files including different options for database, cache, search engine, mail services, file storage, etc. Furthermore, Sail let you share your local sites over the internet to test and get feedback. You can follow this article to begin your new project with Laravel Sail in Windows 10.
8. Valet
Basically, Valet configures MacOS to run Nginx in the background, then uses dnsmasq
to redirect *.test
URLs to your local sites. So unlike Sail it does not provide databases or other services and is not a complete replacement for it. But it's so simple and very lightweight with 7MB of RAM usage with the great feature.
9. Telescope
Debugging code takes a lot of time and Telescope does a good job here. Within the Telescope panel, you can see the requests coming into your application with details. Inside each request, you can see the payload, headers, session values, and the response that was given back user. Furthermore, it does gives the report on anything that was involved to process the request like database, queries, cache misses or hits, blade views, etc.
10. Dusk
Laravel ships with PHPUnit which makes it possible to do UnitTests and FeatureTests, but sometimes we need to run tests on an actual browser like opening a page, filling up a form, and submitting it to see if it works correctly from the user's perspective. Dusk uses the chrome driver to run tests behind the scene but we also can change it to use Selenium or other options as well.