Top Laravel Packages To Install: Handpicked List From Expert www.bacancytechnology.com
01 Quick Summary: The most popular PHP framework- Laravel becomes handicapped if you eliminate its crucial part- the best Laravel packages. Yeah, sure, I’m not here to eliminate or miss out on these precious gems from the framework. Rather, in this post, I’m going to amalgamate the top Laravel packages altogether in place for your easy access. I’m sure you will bookmark this blog for your future references! Pin it now.
02
Introduction
03 In a short span of time, Laravel has taken the PHP community by storm, and it hasn’t slowed down since its introduction. This is why Laravel does not need any introduction, as it is recognized as one of the fastest-growing backend frameworks. I love this PHP-based framework more than any other framework as it makes the process of software development easier to implement modules, packages, plugins, and components. I am writing this blog post to get you through the top Laravel packages to enhance your web application and performance.
04
What are Laravel packages?
05 Packages are one of the great ways to accelerate web application development and save your valuable time from the tedious task of writing the code from scratch. It can be freely reused anywhere in the code. Laravel has different-different kinds of packages; some of them standalone – Behat and Carbon are the best examples of such pages as they can be freely used with all the frameworks requesting COMPOSER.JS file. In layman’s terms, Laravel Packages, also known as laravel plugins or bundles, are ready-to-use written scripts that you can plug and play into your application at your convenience. Laravel’s packages deserve special attention because they minimize the code and improve the application’s maintainability.
06
How to install Laravel package?
07 The best Laravel packages can be divided into two main categories: Laravel specific packages and framework-independent packages. Laravel specific packages work exclusively with the Laravel framework, whereas framework-independent packages also work with other PHP-based frameworks.
08 Process of Installing Composer Package in Laravel Composer for Laravel is what NPM is to JavaScript. When installing the package or plugin, it’s a straightforward process- write a one-line code in the composer.json file, and your job is done because the composer automatically pulls its package from packagelist.org. To install the Laravel package, the syntax for installing the command line goes like this; composer require packageowner/packagename
09 Use the below command to fetch the updated package php artisan update To use the installed package, instantiate a new object $package = new Package; If the package is namespaced then; $package = new PackageNamespace\Package; To ensure validation at vendor/composer/autoload_* files. You can also ensure it from the main package source file. vendor/vendorName/packageName/[src or lib or whatever]/Package.php
10
Buckle up your tech stack with the latest trending updates in Laravel! Develop a low-maintenance, flexible & secure website in minimal costs and adorn it with 3rd party plugins. Hire Laravel Developer from us and pose at the demanding nerve of the market edge.
11
Top Laravel Packages: Preserve the List
12 Let’s have a look at the best Laravel packages to optimize the performance of your Laravel application.
1. Laravel Debugbar
One of my favorites among the top Laravel packages is Debugbar that I mostly use to audit the code. It adds a dev toolbar to display exceptions, debug messages, routes, open views, and DB queries for the application. It will also show the rendered templates and parameters that you have passed.
13 Usage: Add using the Façade and PSR-3 levels Debugbar::info($object); Debugbar::error('Error!'); Debugbar::warning('Watch out…'); Debugbar::addMessage('Another message', 'mylabel'); And start/stop timing: Debugbar::startMeasure('render','Time for rendering'); Debugbar::stopMeasure('render'); Debugbar::addMeasure('now', LARAVEL_START, microtime(true)); Debugbar::measure('My long operation', function() { // Do something… }); Source: Github– 13.5k stars, 1.3k fork
14 2. Entrust This package comes in handy when it comes to adding role-based permissions to your Laravel 5 application. Entrust is divided into 4 different categories: Store role records, store permission records, store relations between roles and users and store various relations between roles and permission. Concept $admin = new Role(); $admin->name = 'admin'; $admin->display_name = 'User Administrator'; // optional $admin->description = 'User is allowed to manage and edit other users'; // optional $admin->save();
15 Next, assign them to the user.
$user = User::where('username', '=', 'michele')->first(); // role attach alias $user->attachRole($admin); // parameter can be an Role object, array, or id // or eloquent's original technique $user->roles()->attach($admin->id); // id only
16 Add role-based permissions: $createPost = new Permission(); $createPost->name = 'create-post'; $createPost->display_name = 'Create Posts'; // optional // Allow a user to... $createPost->description = 'create new blog posts'; // optional $createPost->save(); $editUser = new Permission(); $editUser->name = 'edit-user'; $editUser->display_name = 'Edit Users'; // optional // Allow a user to... $editUser->description = 'edit existing users'; // optional $editUser->save();
17 $admin->attachPermission($createPost); // equivalent to $admin->perms()>sync(array($createPost->id)); $owner>attachPermissions(array($createPost, $editUser)); // equivalent to $owner->perms()>sync(array($createPost->id, $editUser>id))
Source: GitHub– 6.2k stars, 1.3k fork
18 3. Sentry
I am pretty sure that you are familiar with the Laravel error tracking service. Sentry has its own Laravel integration. For any unexpected error, you will receive an email outlining what’s wrong with the ongoing app. To inspect the entire block of code and track group errors, it’s a convenient feature for the dashboard. Source: GitHub– 1k stars, 149 forks
19 4. Bugsnag
To manage the expectations and monitor the errors, it is another cross-platform tool. Just like the Sentry, it offers fully customizable filtering and reporting. Instead of email, you will receive notification through Slack and Pagerduty Source: GitHub– 780 stars, 111 forks
20 5. Socialite
One of the simplest and easiest ways to handle OAuth authentication. Where users can sign in with the help of the most popular social networks like Facebook, Gmail, Twitter, BigBucket, and GitHub.
21 redirect(); } /** * Obtain the user information from GitHub. * * @return \Illuminate\Http\Response */ public function handleProviderCallback() { $user = Socialite::driver('github')>user(); // $user->token; } } Source: Laravel GitHub: 5k stars, 807 forks
22 6. Laravel Mix
Laravel Mix is known as Laravel Elixir, widely used to create an interactive API for webpack-build steps for your project. This tool is commonly used for optimizing and compiling assets in Laravel application similar to the gulp and Grant. Install Laravel Run npm install Visit your webpack.mix.js file, and get started! GitHub: 4.9k stars, 796 forks
23 7. Eloquent-Sluggable The purpose of this package is to provide a unique slug – a simplified version of string – that eliminates ampersands, accented letters, and spaces converting it into one case, and this package aims to make users happier with automatic and minimal configuration.
use Cviebrock\EloquentSluggable\Sluggable; class Post extends Model { use Sluggable; /** * Return the sluggable configuration array for this model. * * @return array */ public function sluggable() { return [ 'slug' => [ 'source' => 'title' ] ]; } } ource: GitHub– 3.3k stars, 424 forks
24
25 There’s an avalanche of Laravel Packages!
Only the expert Laravel developers will find out the best Laravel packages for your project. Get in touch with the best Laravel Development Company!
26 8. Laravel Heyman
Laravel Heyman lets you validate, authenticate and authorize rest of your application’s code.
27 <?xml version="1.0" encoding="UTF-8"?> <phpunit backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php"
colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false"
28 > <testsuites> <testsuite name="Package Test Suite"> <directory suffix=".php">./tests/</directory> </testsuite> </testsuites> <PHP> <env name="APP_ENV" value="testing"/> <env name="CACHE_DRIVER" value="array"/>
29 <env name="SESSION_DRIVER" value="array"/> </php> <logging> <log type="coverage-clover" target="/tmp/coverage.xml"/> </logging> <filter> <whitelist addUncoveredFilesFromWhitelist="true"> <directory suffix=".php">./src</directory> </whitelist> </filter> </phpunit>
30 9. Laravel Charts
Charts is a PHP Laravel library to handle unlimited combinations of the charts. It is specifically designed to be loaded over AJAX and can be used without any external efforts. Laravel charts package makes use of simple API to create JS logic for your web application. Installation: composer require consoletvs/charts Source: GitHub– 274 stars, 66 forks
31 10. Laravel Form Builder Laravel form builder is inspired by Symfony’s form builder to create forms that can be easily modified and reused at our convenience. This package provides external support for Bootstrap3. To install: Via Composer composer require kris/laravel-form-builder To use bootstrap 4 composer require ycs77/laravel-formbuilder-bs4 Source: GitHub– 1.6k stars, 297 forks
32 11. Spatie The sole purpose of creating a Spatie package is to allow you to embed roles and permissions within your application. Setting up different roles and admin permission on various activities within your website or the application is essential, considering the security and viability. While you can do it manually, the Spatie Laravel Packages gives you the ease to push roles right from the database. Installing the package composer require spatie/laravel-permission
33 Push Migration php artisan vendor:publish -provider="Spatie\Permission\PermissionSe rviceProvider" --tag="migrations" Migrate to Database PHP artisan migrate Publishing Configuration Files php artisan vendor:publish -provider="Spatie\Permission\PermissionSe rviceProvider" --tag="config" Source: GitHub– 10k stars, 1.5k forks
34
Accelerate Your Web Application Using Laravel Optimize Performance of Laravel Application
35 12. Laravel User Verification Setting up a website and registering users, and you would need to have an email validation form embedded. The Laravel User Verification Package does the same. It is designed in a way that can store as well as handle validation tokens every time a user clicks for verification. Installing the package composer require jrean/laravel-userverification
36 Edit the RegisterController.php file
public function register(Request $request) { $this->validator($request->all())>validate(); $user = $this->create($request->all()); event(new Registered($user)); $this->guard()->login($user); UserVerification::generate($user); UserVerification::send($user, 'My Custom E-mail Subject');
37 return $this->registered($request, $user) ?: redirect($this->redirectPath()); }
Source: Github– 759 stars, 108 forks
38 13. Migration Generator Having multiple database tables isn’t something new. Instead, every website has two or more tables to store different forms of data. The Migration Generator Laravel Packages is one that allows you to initiate migrations from one table to another. These include foreign keys, indexes, and further allows you to make a pick of tables involved in the migration. Installing the package composer require –dev “kitloong/laravelmigrations-generator” Source: Github– 871 stars, 107 forks
39 14. Laravel Backup Create a robust backup of all your data files with this exclusive package, Laravel Backup. Keeping in mind the need to have the data stored and backed up, developers have designed the Laravel Backup package that creates a zip file of the application along with the data stored within it. The package gives the flexibility to store them at any of the systems. Installing the package composer require spatie/laravel-backup To take backup, execute the following command: php artisan backup: run Source: GitHub– 4.8k stars, 675 forks
40 15. No Captcha The No Captcha Laravel Packages is designed, keeping in mind the need to avoid spamming activities. What the package does is implement the protection and validation of Google reCaptcha. The sole purpose here is to prevent all sorts of spamming and render the website error-free. To initiate the package, you are first required to get access to the API key. This is available free from reCaptcha, and once obtained, you can then run the following.
41 Add the following in app/config/app.php The ServiceProvider to the provider’s array: Anhskohbo\NoCaptcha\NoCaptchaServiceP rovider::class, The class alias to the aliases array: 'NoCaptcha' => Anhskohbo\NoCaptcha\Facades\NoCaptcha ::class, Publish the config file: php artisan vendor:publish -provider="Anhskohbo\NoCaptcha\NoCaptc haServiceProvider" Source: GitHub– 1.5k stars, 217 forks
42 16. Laravel GraphQL If you have been accustomed to the concept of using traditional REST architecture, you will love the way Laravel’s GraphQL package behaves. Designed as the data query language, GraphQL makes it easier for developers to define their server structure and embed GraphQL within their apps. Installing The GraphQL Package composer require rebing/graphql-laravel In case you are using Laravel 5.5 or above, the package would be detected automatically. However, for versions below 5.5, you need to add the following: Rebing\GraphQL\GraphQLServiceProvider: :class
43 and, GraphQL' => 'Rebing\GraphQL\Support\Facades\GraphQ L', Publish and View The Configuration File: $ php artisan vendor:publish -provider="Rebing\GraphQL\GraphQLServic eProvider" config/graphql.php
44 Create Schemas For Designing The Endpoints of GraphQL 'schema' => 'default_schema', 'schemas' => [ 'default' => [ 'query' => [ 'example_query' => ExampleQuery::class, ], 'mutation' => [ 'example_mutation' => ExampleMutation::class, ], ], 'user' => [ 'query' => [ 'profile' => App\GraphQL\Queries\ProfileQuery::class ],
45 'mutation' => [ ], 'middleware' => ['auth'], ], ],
Source: GitHub– 1.7k stars, 221 forks
46 17. Tinker Tinker is exceptionally useful and one of the top Laravel packages that helps developers test and try certain features without actually writing a script. In other words, the package allows debugging in real-time. Suppose that you want to check a few records in the database or perform specific operations. The Tinker Laravel Packages would enable you to test and debug on your browser screen in a matter of clicks. The Tinker Laravel plugin has Laravel framework embedded within and hence, eliminates the need to manually install the same when using it with your application.
47 app instanceof LaravelApplication && $this->app->runningInConsole()) { $this->publishes([$source => config_path('tinker.php')]); } elseif ($this->app instanceof LumenApplication) { $this->app->configure('tinker'); } $this->mergeConfigFrom($source, 'tinker'); } /** * Register the service provider. * * @return void */ public function register() { }
48 $this->app->singleton('command.tinker', function () { return new TinkerCommand; }); $this->commands(['command.tinker']); } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['command.tinker']; } Souce: GitHub– 7k stars, 105 forks
49 18. Intervention/Image Intervention/Image is one Laravel Packages that allows developers to create, edit, and appealingly modify images. The package is open-source, and developers can use it as per their requirement. In order to install the said package, run the following:
composer require intervention/image
Source: GitHub– 12.3k stars, 1.4k forks
50 19. Beautymail An easy to use package enabling one-click addition of emails within the Laravel application, Beautymail has a huge repository of inbuilt templates that can be used for sending emails. Developers have the freedom to create their own HTML template and use it along with Beautymail. publishes([ __DIR__.'/../../config/settings.php' => config_path('beautymail.php'), ], 'config'); $this->publishes([ __DIR__.'/../../../public' => public_path('vendor/beautymail'), ], 'public');
51 $this>loadViewsFrom(__DIR__.'/../../views', 'beautymail'); try { $this->app['mailer']>getSwiftMailer()->registerPlugin(new CssInlinerPlugin()); } catch (\Exception $e) { \Log::debug('Skipped registering SwiftMailer plugin: CssInlinerPlugin.'); } }
Source: GitHub– 995 stars, 173 forks
52 20. Laravel Slack With Laravel, you can quickly push all your notifications to the standard slack Channel. However, with the onset of the Laravel Slack package, you now have the ease to simplify things the way you want them to be. The package allows you to send messages directly from the platform to different channels. class HelloMessage extends SlackMessage { public $content = "Hey bob, I'm a sending a custom SlackMessage"; public $channel = '@bob'; } \Slack::send(new SlackMessage()); If needed, a dummy can be created to test the feature and functionality of the package. Source: GitHub– 275 stars, 35 forks
53
Key Take Away on Best Laravel Packages
54 With this, we come to an end to the list of top packages for Laravel applications. It is seen that these top Laravel packages are extremely helpful in cutting down the time of development while enhancing the end to end productivity. So, if you are planning to optimize your applications or build a new one, the packages, as mentioned above, would be a great help to take into consideration. If you are looking for the experts who can do the needful, then hire php developers from us as we are a globally renowned Laravel development company and have helped all the shapes and sizes of businesses to succeed in today’s digital world. Go check out our helpful Laravel Tutorial page that depicts the expertise and community service of our dedicated Laravel Developers.
Thank You
www.bacancytechnology.com