14 Nov 2022

Top Laravel Packages in 2022

What is a Package in Laravel?

Laravel is among the most popular frameworks for web apps and offers a simple and fast development environment. It has packages that let you add more functionality. These packages have routes, controllers, views, and configurations to improve a Laravel application.

Laravel packages let you use different ways of accessing relational databases and perform dependency injections. Currently, we have over 500 Laravel packages that offer all sorts of functionality, from booking and travel to eCommerce and instruction.

Laravel offers two packages: One is framework-independent (stand-alone), and the other is for a specific framework.

One of the primary advantages of using Laravel packages is that they let you access all the framework’s features to its host application, including routing, migrations, tests, views, and numerous other useful features. Also, these packages significantly reduce code repetition via the Don’t Report Yourself (DRY) principle.

This blog lists the best Laravel packages regularly used in Laravel applications.

Best Laravel Packages

Let’s have a look at the best Laravel packages below, which you can use to optimize your application performance.

1. Spatie

Roles and permissions form an important part of many web applications. And Spatie offers you the best permission package to manage roles and permissions. With Spatie, you get the following benefits:

Advantages

  1. Roles
  2. Permissions
  3. Direct Permissions
  4. Middleware
  5. Multiple Blade Directives
  6. Artisan commands

2. Laravel Debugbar

laravel-debugger

Laravel Debugbar is among the best Laravel packages that help users add a developer toolbar to their application(s). This package is mainly used for debugging purposes .

Debugbar provides you with many options and shows all the queries your application offers. It also displays all the rendered templates and parameters you’ve passed. You can add messages using the Façade (when added), shown under the ‘Messages’ tab in Laravel Debugbar.

  1. Debugbar::info($object);
  2. Debugbar::error('Error!');
  3. Debugbar::warning('Watch out…');
  4. Debugbar::addMessage('Another message', 'mylabel')

3. Laravel User Verification

The Laravel User Verification package allows you to handle user verification and validates email(s).

It generates and stores a verification token for the registered user, sends or queues an email with the verification token link, handles the token verification, and sets the user as verified. This package also provides the verified route middleware functionality.

  1. public function register(Request $request)
  2. {
  3. $this->validator($request->all())->validate();
  4. $user = $this->create($request->all());
  5. event(new Registered($user));
  6. $this->guard()->login($user);
  7. UserVerification::generate($user);
  8. UserVerification::send($user, 'My Custom E-mail Subject');
  9. return $this->registered($request, $user)
  10. ?: redirect($this->redirectPath());
  11. }

4. Socialite

Socialite offers a simple and easy way to handle OAuth authentication. It allows the users to login via some of the most popular social networks and services, including Facebook, Twitter, Google, GitHub, and BitBucket.

  1. $user = Socialite::driver('github')->user();
  2. // OAuth Two Providers
  3. $token = $user->token;
  4. $refreshToken = $user->refreshToken; // not always provided
  5. $expiresIn = $user->expiresIn;
  6. // All Providers
  7. $user->getId();
  8. $user->getName();
  9. $user->getEmail();
  10. $user->getAvatar();

5. Laravel Mix

Formerly known as Laravel Elixir, Laravel Mix provides a clean and rich Application Programming Interface (API) for defining webpack-build steps for your project. It is the most powerful asset compilation tool available for Laravel today.

laravel-mix

 

  1. mix.js('resources/assets/js/app.js', 'public/js')
  2. .sass('resources/assets/sass/app.scss', 'public/css');

6. Eloquent-Sluggable

Slugging is the process of creating a simplified, URL-friendly version of a string by converting it to one case and removing spaces, accented letters, ampersands, etc. With Eloquent-Sluggable, you can easily create slugs for all the Eloquent models in your project .

 

  1. class Post extends Eloquent
  2. {
  3. use Sluggable;
  4. protected $fillable = ['title'];
  5. public function sluggable() {
  6. return [
  7. 'slug' => [
  8. 'source' => ['title']
  9. ]
  10. ];
  11. }
  12. }
  13. $post = new Post([
  14. 'title' => 'My Awesome Blog Post',
  15. ]);
  16. // $post->slug is "my-awesome-blog-post

7. Migration Generator

Migration Generator is a Laravel package that allows you to generate migrations from an existing database, including indexes and foreign keys. You can create migrations for all the tables in your database by running the following command:

  1. php artisan migrate:generate

You can also choose only certain tables that you want to migrate:

  1. php artisan migrate:generate table1,table2

8 .Laravel Backup

laravel-backup

Laravel Backup creates a backup of all your files within an application. It creates a zip file that contains all files in your specified directories, along with a dump of your database.

You can store a backup on any file system. To create a backup, all you need to do is to run the following command:

  1. php artisan backup:run

9. Entrust

Entrust provides a flexible way to add role-based permissions to your Laravel 5 application. This package creates the following four tables:

  • roles table for storing role records
  • permissions table for storing permission records
  • role_user table for storing one-to-many relations between roles and users
  • permission_role table for storing many-to-many relations between roles and permissions.

You can create a role by executing the following lines of code:

  1. $admin = new Role();
  2. $admin->name = 'admin';
  3. $admin->display_name = 'User Administrator'; // optional
  4. $admin->description = 'User is allowed to manage and edit other users'; // optional
  5. $admin->save();

Let’s check how to assign the roles to the users,

  1. user = User::where('username', '=', 'michele')->first();
  2. $user->attachRole($admin);
  3. Now, you must give permissions to these roles:
  4. $createPost = new Permission();
  5. $createPost->name = 'create-post';
  6. $createPost->display_name = 'Create Posts';
  7. $createPost->description = 'create new blog posts';
  8. $createPost->save();
  9. $admin->attachPermission($createPost);

10. No Captcha

No Captcha is a package for implementing Google reCaptcha validation and protecting forms from spamming. It requires you to obtain a free API key from reCaptcha.

  1. NoCaptcha::shouldReceive('verifyResponse')
  2. ->once()
  3. ->andReturn(true);
  4. $response = $this->json('POST', '/register', [
  5. 'g-recaptcha-response' => '1',
  6. 'name' => 'Pardeep',
  7. 'email' => 'pardeep@example.com',
  8. 'password' => '123456',
  9. 'password_confirmation' => '123456',
  10. ]);

11. Laravel GraphQL

GraphQL is a data query language that provides an alternative to traditional REST architecture. Besides GraphQL, you can also read more about the Laravel Forge alternative .

This Laravel package helps you set up and use GraphQL in your Laravel apps. Developers use this package to define the required data structure and get the same structure from the server.

Laravel Admin Panel Generator

Admin panel generator has two main groups: visual builders and console-based. The choice depends on your preferences, whether you like to use GUI or prefer typing Artisan commands with parameters.

Also, an important term to remember here is CRUD (Create, Read, Update, Delete) — the core operations that are the building blocks of all admin panels.

12. Voyager: The Missing Laravel Admin

Voyager stands out with a polished and professional interface. This Laravel package offers clear usage instructions, a user-friendly front-end theme, and no apparent bugs or unfinished parts. Voyager offers interesting features, such as dummy-data, media manager, etc.

Voyager offers interesting features, such as dummy-data, media manager, etc.

13.LaraAdmin: Admin Panel + CRM

After installing and logging into your admin panel, the LaraAdmin package allows you to visually create modules representing your CRUDs.

14. Orchid

Orchid works fittingly well for building a business application using the Laravel framework. It acts as a core base for web applications and performs the functions of CMS, CMF, or admin panel for your website.

Laravel Ecommerce Packages

15. Bagisto

Bagisto is an open-source Laravel eCommerce package that caught the Laravel community’s eyes in a very short time. It offers out-of-the-box Laravel user management, multi-warehouse inventory management options, and more.

Also, the Laravel CMS package is bundled with built-in user-friendly admin panel navigation, and offers functionalities like multi-currency, localization, access control level, multi-channel, Payment integration, and much more.

16. AvoRed

AvoRed easily lets you customize the open-source Laravel Shopping Cart as per your needs. It offers a mobile-friendly interface layout by default and is also included among the best Laravel SEO packages.

AvoRed allows you to create product entities like categories, attributes, etc., with efficient order management capabilities for order tracking, customer information, inventory management, and more.

17. Laravel Telescope

Laravel Telescope is an elegant PHP debugger for the Laravel framework. It provides vivid insights into the requests coming onto your application, exceptions, log entries, database queries, notifications, cache operations, and much more. All these insights make Telescope a useful addition to your local Laravel development environment.

Improve Your Laravel App Speed by 300%

Cloudways offers you dedicated servers with SSD storage, custom performance, an optimized stack, and more for 300% faster load times.

Laravel SEO Packages

Laravel Meta Manager

Laravel Meta Manager lets you optimize your website’s SEO, helping your website rank higher on the SERPs. It emphasizes the application’s Meta tags and allows you to correct them following the best SEO practices.

The package comes with recommended Meta tags, including Standard SEO, Dublin Core, Google Plus, Facebook Open Graph, and many others.

SEOTools

SEOTools allows you to optimize your Laravel SEO according to the best SEO practices. It offers excellent website optimization features and is supported by both Laravel and Lumen frameworks.

The package is fairly easy to integrate within the projects, as it has a user-friendly interface that is also beginner-friendly. It also lets you set the titles and Meta tags for both Twitter and Open Graph.

AutoMeta

AutoMeta is an excellent SEO optimization tool for Laravel that helps developers with standard SEO techniques. It is one of the top SEO tools for Laravel, providing easy management of the website’s meta tags. The package also helps fix some common SEO bugs in the application and simplifies crawling for search engine bots.

Laravel Seoable

Laravel Seoable is among the most used SEO packages for Laravel projects. It offers good SEO techniques that fine-tune the Laravel apps for search engine rankings.

This package defines some core Laravel functions following the SEO best practices, such as mapping Eloquent attributes to SEO Meta tags, setting custom templates for page titles/descriptions, defining custom SEO data for application models, and more.

Laravel-SEO

Laravel-SEO is another handy SEO package that allows you to insert, manage, and delete website Meta tags. You can use this package to insert structured data into the Laravel projects and manage some of the most used SEO Meta tags like Facebook Open Graph, Dublin Core, and others effortlessly.

Laravel Package Development Process

When writing Laravel packages, your package won’t have access to all Laravel’s testing helpers. So, if you want to write your package tests as if they existed within a typical Laravel application, you can use the Orchestral Testbench package .

  1. Setup your Composer.json file for New Package
  2. Add Service Provider
  3. Set Alias
  4. Create a Facade class

These are four important steps that you must know for writing a Laravel package for your speedy development process.

Final Words

This blog has listed the best Laravel packages to help you optimize your project’s productivity.

Choosing the right Laravel package mainly depends upon your project’s requirements. As Laravel provides ease to developers for executing custom-defined operations, you can use these packages to perform functional tasks efficiently.

If you want to recommend more Laravel packages, feel free to share them in the comments below.


Thank you: cloudways

 https://www.cloudways.com/blog/best-laravel-packages/#spite

No comments:

Post a Comment