Frustrated by rewriting the same code for everyday tasks in your Laravel projects? Building features from scratch can be a huge time taken, slowing you down and hindering your development speed.
There's a better way! Enter Laravel packages: pre-built, reusable code modules designed to tackle common functionalities. These powerful tools can streamline your workflow, tighten your application's security, and supercharge its features – all without reinventing the wheel.
This article is your one-stop guide to unlocking the potential of Laravel packages. We'll delve into the different types available, clear up any confusion between packages and bundles, and unveil a curated list of the best Laravel packages to skyrocket your app development speed in 2024. Let's dive in!
What is a Laravel Package?
A Laravel package is a pre-written and reusable chunk of code that adds specific functionality to your Laravel application. Think of it like a toolbox filled with specialized tools for different development tasks.
Here's what makes them so valuable:
- Save Time: No need to build everything from scratch. Packages handle common functionalities, letting you focus on your app's core features.
- Boost Efficiency: Streamline your development workflow by utilizing pre-built solutions.
- Enhance Security: Many packages focus on security best practices, strengthening your application.
- Expand Functionality: Add new features and capabilities without reinventing the wheel.
The Best Integrated Development Environment for Laravel in 2024
A great way to accelerate development is to identify the packages that will provide the functionality we need out of the box. We have drawn from our experience working with multiple Laravel projects, to create this list of what we believe are the top ten Laravel packages. Packages add functionality to Laravel. Packages can be a great way to work with dates like Carbon or an entire testing framework like Behat.
There are different types of packages. Some are standalone, which means they will work with all frameworks. Both Carbon and Behat are examples of such packages. It's easy to use these packages - simply by requesting it in COMPOSER.JS file. The Packages mentioned here - whether for routes, controllers, views or configuration - are there to enhance Laravel application, and can be used only for Laravel.
Most Used Laravel Packages in 2024
1. Intervention Image
2. Laravel Debug Bar
3. Laravel IDE Helper
4. Laravel HTML
5. Laravel Generator
6. Laravel Excel
7. Laravel Schema
8. Laravel JSValidation
9. Agent
10. Laravel Bootstrap
1. Intervention Image
Laravel Package Name: Image
Maintainer: intervention
Creating a thumbnail or manipulating images can be a time-consuming process, especially in eCommerce projects where scores of such images are required. Laravel has introduced the Image package which allows developers to create such images in a jiffy.
Image Package helper class helps developers manipulate images in many ways. It provides features such as saving thumbnails of the image, setting it as grayscale, and a whole lot more, which is why the Image package is high on our top ten best Laravel packages list.
2. Laravel Debug Bar
Laravel Package Name: Laravel-debugbar
Maintainer: barryvdh
This is an absolute must for development. It installs a debug bar that sits at the bottom of the page and provides helpful information on routes, DB queries and more. This is easily one of the best Laravel packages.Note:- This is a package used to integrate PHP Debug Bar with Laravel 5.
It includes a ServiceProvider to register the debug bar and attach it to the output. You can publish assets and configure it through Laravel. It bootstraps some Collectors to work with Laravel and implements a couple of custom DataCollectors, specific to Laravel. It is configured to display Redirects and (jQuery) Ajax Requests.
3. Laravel IDE Helper
Laravel Package Name: Laravel-ide-helper
Maintainer: barryvdh
This installs a helper class, which helps PhpStorm recognize the application’s Laravel classes, so the developer doesn’t end up with unnecessary error messages from his IDE. This one doesn’t need configuration in config/app.php. Instead, one would have to initialize artisan commands.
4. Laravel HTML
Laravel Package Name: Html
Maintainer: laravelcollective
This one replaces the illuminate/html class since that class is no longer supported and is no longer included in the core as of Laravel 5.
This package is essential if you like using the form model binding as shown below:
{!!Form::model($marketingImage, ['route' => ['marketingimage.destroy',
$marketingImage->id],
'method' => 'DELETE',
'class' => 'form',
'files' => true]
)!!}
But obviously, this is not very necessary, which is why it’s no longer in the core.
You could simply create a form manually using bootstrap. You must remember to add:
<input type="hidden" name="_token" value="{{ csrf_token() }}">
That will add your csrf token to the post data.This is very convenient which is why I use it whenever I can. When you are installing this, you will see instructions for adding the ‘Form’ alias. Please note that the bootstrapper package has Form alias as well and you cannot use both because it will cause a conflict. You can avoid the conflict by simply avoiding the bootstrapper form alias.
Note: Most instructions for adding to the providers array and the alias array do not use the new PHP::class syntax. I recommend using the new syntax, which is better because it allows you to use your IDE to click into the class.
For example, old style alias:
'Form' => 'CollectiveHtmlFormFacade'
New style:'Form' => CollectiveHtmlFormFacade::class,
You can do the same for the providers, in this case, it's the html provider:CollectiveHtmlHtmlServiceProvider::class,
5. Laravel Generator
Laravel Package Name: Generators
Maintainer: Created for Laravel 4 by JeffreyWay and extended for Laravel 5 by Laracasts
This Laravel package provides a variety of generators to speed up your development process. These generators include:
generate:model
generate:view
generate:controller
generate:seed
generate:migration
generate:pivot
generate:resource
Generate:scaffold
Laracast generators give us an artisan command for creating pivot table migrations, making them an integral part of any top 10 Laravel packages list.
6. Laravel Excel
Lavarel Package Name: Excel
Maintainer: Maatwebsite
Laravel Excel brings the power of PHP Office’s PHPExcel to Laravel 5 with a touch of the Laravel Magic. It includes features like importing Excel and CSV to collections, exporting models, arrays, and views to Excel, importing batches of files and importing a file through the config file.
The package also has a solution for dealing with very large imports. We can now use ->chunk() to import the data in chunks. Together with a queue, it can import large quantities of data, making it a top rated Laravel package for developers.
7. Laravel Schema
Laravel Package Name: Laravel-schema
Maintainer: autn
Be it a professional developer or just a beginner, everyone wants to get rid of the need for database querying. Writing queries requires you to remember the syntax and be cautious since a single mistake can lead to a big disaster. Laravel Schema Package had made all the database manipulation and operations very easy. Now developers have a lot of options to make database dance to their tunes without having to remember the syntax.Laravel-schema package is helpful to view the schema information from Application server instead of logging into the Database server. It generates Mysql database schema from migration files. With this package, we can easily create database tables and perform all database operations without writing complicated queries.
You can understand the ease of use of Laravel Schema package with the following example of table creation.
To create a new database table,
the Schema::create method is used:Schema::create('users', function($table)
{
$table->increments('id');
});
The first argument passed to the create method is the name of the table and the second is a closure which will receive a Blueprint object which may be used to define the new table.
8. Laravel JSValidation
Laravel Package Name: Laravel-jsvalidation
Maintainer :proengsoft
Validating every field of a form is a very tedious and time-consuming job with loads of space for error. Every time when we need to validate things, we re-write the code. Laravel had fixed this problem for everyone by releasing a validation Package, which is naturally a top ten Laravel package, given the amount of workload it reduces.
Developers can validate forms automatically by referencing them to their pre-defined validations. The messages are loaded from our validations and translated according to your localization preferences. With JSvalidation, we can validate our forms using Javascript automatically. The main goal of this package is its ability to reuse our PHP validation logic to validate forms via Javascript. If we validate our forms using a controller, the simplest way to reuse our validation rules is by sharing our rules between controller methods. By using FormRequest, you could configure your validations directly in the view.
The Laravel Javascript Validation package helps us reuse our Laravel Validation Rules, Messages, FormRequest and Validators to validate forms automatically on the client side without re-writing any Javascript code or using HTML Builder Class.
9. Agent
Laravel Package Name: Agent
Maintainer: jensseggersAgent is a PHP desktop/mobile user agent parser with support for Laravel, based on Mobile Detect. It provides both desktop support and additional functionality. This Laravel package utilizes Mobile Detect PHP Class under the hood:Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string in combination with specific HTTP headers to detect the mobile environment.
Besides, another reason we chose it as one of our top ten Laravel packages is its sweet syntax:Agent::is('Windows');
Agent::isNexus();
Agent::isMobile();
10. Laravel Bootstrap
Laravel Package Name: Bootstrapper
Maintainer: Patricktalmadge
This is a pretty wrapper for a lot of bootstrap-related work. I haven’t gone too far deep into it, but I do use the breadcrumb widget. As I noted in the laravel collective HTML package, there is a conflict with the form alias. I would advise that you leave that out when updating the aliases array in config/app.php.
As Laravel continues to progress and more packages enter the marketplace, we will cover them for sure.