Laravel doesn’t need an introduction. Shortly after it was launched, it took the PHP community by storm, and it hasn’t slowed down since. As the community around it grows, so does the number of resources available to its users. Today, we’re going to cover some of the best Laravel packages for you.
What are Laravel Packages?
One of the many great things that Laravel brings to the table is simplifying the development process. When working on a new project, sooner or later you’ll find yourself having to write a long stretch of code to handle seemingly simple things, such as authentication or caching.
To save you from the dubious task of writing it from scratch, Laravel gives you Packages. These are the sort of components that provide specific functionalities and can be freely reused anywhere in the code.
They provide access to all the features Laravel offers to its host application. They also follow the DRY Principle, minimizing the amount of code used and improving the app’s maintainability.
You can create Packages (also referred to as Laravel plugins) on your own. Or, better yet, instead of writing them from scratch, you can take advantage of a multitude of Laravel Packages available online for anyone to use.
There are two types of packages that work with Laravel apps:
- Framework-independent packages suitable for Laravel, but also other PHP frameworks
- Laravel-specific packages that work exclusively with this framework
How to install Laravel Packages
The main way of getting packages installed in Laravel is via Composer – a tool for dependency management in PHP.
Installation via Composer
This installation is pretty straightforward. Assuming the package is already on packagist.org, you can insert the following syntax into the command line:
composer require package_owner/package_name
For example, Laravel Debugbar is installed with:
composer require barryvdh/laravel-debugbar
Composer will automatically load a package of your choice for you, and all you have to do is initiate a new Object of the Package class:
$package = new Package;
or
$package = new PackageNamespacePackage;
for a namespaced package. That’s all!
If Composer can’t handle a package, there are many other alternative methods. Explore them all on Getcomposer.org.
Best Laravel Packages to use
Finally, since we have the basics figured out, let’s get to the essence of this article. We’ve prepared a list of some awesome Laravel packages for you, split into a number of categories.
Authentication
User Verification
This useful Laravel package allows you to verify users and validate their emails so you don’t send transactional emails to fake accounts (hurting your deliverability).
User Verification package generates a verification token for each registered user and sends verification emails on your behalf. It’s also capable of handling the verification and marking users as verified (or not).
See an example of using this package here.
No Captcha
No Captcha, contrary to its name, does provide Google reCaptcha capability to your Laravel app. It’s very simple – you provide it with your reCaptcha site and secret key, and it renders the appropriate code to insert in your app.
Heyman
Laravel Heyman lets you fully decouple things like validation, authentication, and authorization from the rest of your app.
HeyMan::whenYouHitRouteName([
'avatar',
'user-notifications',
'user-notifications.destroy',
'replies.favorite',
'replies.unfavorite',
'threads.update',
'threads.destroy',
'threads.store',
'replies.store',
'replies.update',
'replies.destroy'
])->youShouldBeLoggedIn()->otherwise()->weRespondFrom('\App\Http\Responses\Authentication@handle');
}
Socialite
Socialite is a very popular package for handling social authentication with OAuth. It works with Facebook, Twitter, Github, Bitbucket, and a few others. It handles nearly all the boilerplate, so you can keep your code clean and make logging into your app a breeze.
Auditing
Laravel Debugbar
We mentioned Debugbar earlier on for a reason. After all, it’s one of the most popular Laravel packages used for auditing your code. It adds a dev toolbar to your project so you can debug on the go. It displays debug messages, exceptions, open views, routes, and all the DB queries your app does.
Sentry
Sentry is a popular error monitoring service and, to no surprise, it’s got its own Laravel integration. Whenever these occur, an email hits your inbox outlining what went wrong. It also features a convenient dashboard for tracking and grouping errors, as well as inspecting entire blocks of code in the search for an answer.
Bugsnag
Bugsnag is another cross-platform tool for monitoring errors and exceptions. It’s very similar to Sentry as it offers fully customizable filtering and reporting. The notifications are available not only via email, but also Slack and Pagerduty.
Acelle
Acelle is a self-hosted platform for running email marketing for your Laravel platform. It works like many other ESPs (email sending providers), letting you manage lists of subscribers, setting up automations, tracking your deliveries, and so on.
You can send emails via their servers or connect to external providers such as Amazon SES or SendGrid.
Mail Preview
To complement Acelle or other tools for mailing, you can use a simple plugin called ‘Mail Preview’. It lets you preview your emails and see what they look like before they’re delivered to a large batch of recipients.
When an email is sent (for example, a test one), Mail Preview creates .html and .eml files with its content. You can then preview them in any email client or in a browser.
Beautymail
Beautymail is a handy package for quickly adding email functionality to your platform. You can import a handful of templates and use them to quickly configure all types of transactional emails. You can also build your own HTML templates and use them with Beautymail if you don’t want to use any external services.
Bonus: Mailtrap
While technically not a Laravel plugin, Mailtrap is an environment for testing emails, also those originating from Laravel. By using Laravel’s default sending method, or any of the sending providers, you can route your emails to Mailtrap to inspect them further.
You can see whether they look as expected, analyze the possible display issues, and check whether they have a good chance to get past spam filters.
It’s very easy to integrate with Laravel. We have it covered in detail in our guide to sending emails in Laravel.
Notifications
Laravel Notification Channels
If Laravel’s default choice of notification options isn’t sufficient, you’ll truly embrace Laravel Notification Channels. It’s a collection of drivers for sending custom notifications.
At the time of writing, 41 channels are supported. This includes a number of push/webpush notifications, popular messengers and SMS/VoiP phone system.
Easy Flash Messages
Easy Flash Messages is precisely what it says it is. It’s an easy-peasy package for configuring flash notifications for your app in no time.
How does it work? Before you perform a redirection, make a call to flash() function. You can also customize it in a number of ways – follow their Github for details.
Laravel Slack
Laravel provides a native way of pushing notifications to the Slack channels. If you, however, want to simplify it even further, try Laravel Slack package.
You can use it to send messages to channels and users (or a mix of them). The package also allows sending SlackMessage objects with a few lines of code:
class HelloMessage extends SlackMessage
{
public $content = "Hey bob, I'm a sending a custom SlackMessage";
public $channel = '@bob';
}
\Slack::send(new SlackMessage());
You can also set up a fake instance of Slack to test your notifications before they’re pushed to a public channel.
Ecommerce
Aimeos
Running an online store? Aimeos offers a Laravel package that will give your site eCommerce capabilities in just 5 minutes.
The platform comes with everything you need to run a store, large or small, including support for templates, vouchers, subscriptions, and countless payment gateways.
Laravel Invoicable
Invoicable is a simple package for Laravel that simplifies the process of creating invoices, letting you focus on the more important stuff. It’s gateway-agnostic, so you don’t have to worry about compatibility either.
Bagisto
Bagisto is a popular eCommerce package you can easily integrate with your Laravel project. If offers support for multiple channels and currencies, a number of themes, inventory management, and many others.
The best way to see whether Bagisto may be a fit for you is with the demo.
Blogging
Buzzy
Buzzy is a Laravel package for quickly creating media sharing sites. This can be a news site, a blog, or a platform for sharing and voting on media – the choice is yours.
The tool comes with unlimited widgets, pages, and categories. If WordPress didn’t appeal to you for some reason, Buzzy very well may do.
Botble
Botble is a CMS package for Laravel. With its help, you can freely create, edit and manage nearly any kind of digital content.
It supports multiple backend languages, and comes with several customizable themes and Google Analytics support. It’s another perfect way to start a news or media sharing site in very little time.
Sluggable
Sluggable, on the other hand, will simplify your life by creating SEO-friendly slugs. It removes spaces, language-specific characters or any other problematic signs, and converts them all into easy-to-parse strings.
Wrapping up
This wraps up our list, but, of course, there’s a lot more out there. Packalyst makes for a pretty compelling source, currently with over 15k packages.
Of course, you can also freely explore Packagist with its huge database of packages installable via Composer. New ones are added daily and, of course, you’re also welcome to contribute with your own code.
Interested in learning more about sending good emails? You’re in the right place, as email is our domain. On the Mailtrap blog, you’ll find tons of resources for improving your deliverability, avoiding spam filters, picking the right software for sending, and many others.
Until next time!
Comments
4 replies