15 Essential Packages for Extending Laravel

KrishaWeb
5 min readDec 20, 2017

--

Laravel is one of one of the most popular PHP frameworks for developing web applications. It supplies a number of fantastic attributes such as simple and also quick routing, various methods for accessing relational databases, effective reliance shot and much more.

In this write-up we are going to show you 15 superb open-source PHP libraries for prolonging Laravel. You could easily include them in any kind of Laravel task to add numerous energies and improve your process.

Laravel Debugbar

A plan for Laravel 5 which adds a developer toolbar for debugging the PHP and also Laravel code of your app. There are lots of alternatives which permit you to show all queries, get details about the present Route, reveal the currently loaded views, and also far more.

// All arguments will be dumped as a debug message
debug($var1, $someString, $intValue, $object);

// Measure render time or other events.
start_measure('render','Time for rendering');
stop_measure('render');
add_measure('now', LARAVEL_START, microtime(true));
measure('My long operation', function() {
// Do something…
});

Entrust

Entrust is a Laravel 5 bundle which gives you a flexible method to add role-based authorizations to your task. The collection creates four brand-new tables: roles, permissions, role_user and also permission_role, which you can make, use of to set up roles with different degrees of access.

// Creating role and permissions
$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();

Socialite

Socialite supplies a straightforward and simple way to handle OAuth authentication. It makes it possible for your individuals to log-in through several of one of the most prominent social networks and also services consisting of Facebook, Twitter, Google, GitHub as well as BitBucket.

$user = Socialite::driver('github')->user();

// OAuth Two Providers
$token = $user->token;
$refreshToken = $user->refreshToken; // not always provided
$expiresIn = $user->expiresIn;

// All Providers
$user->getId();
$user->getName();
$user->getEmail();
$user->getAvatar();

User Verification

A bundle that enables you to verify users as well as validate emails. It creates as well as stores a verification token for the registered customer, sends an e-mail with the verification token link, deals with the token verification, and also establishes the user as verified.

protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
]);
}

Tinker

Tinker allows you to interact with your whole Laravel application from the command line as well as access all the Eloquent work, events, as well as items. It utilized to be component of Laravel, yet after variation 5.4 it remains in an optional add-on that should be set up independently.

Breadcrumbs

With this plan you could develop breadcrumb web page controls in a straightforward and also simple way. It supports a few of one of the most popular front-end frameworks such as Bootstrap, Bulma, foundation as well as Materialize.

// Home > Photos
Breadcrumbs::register('photo.index', function ($breadcrumbs) {
$breadcrumbs->parent('Home');
$breadcrumbs->push('Photos', route('photo.index'));
});

// Home > Photos > Upload Photo
Breadcrumbs::register('photo.create', function ($breadcrumbs) {
$breadcrumbs->parent('photo.index');
$breadcrumbs->push('Upload Photo', route('photo.create'));
});

Eloquent-Sluggable

Slugging is producing a streamlined, URL-friendly version of a string by converting it to one instance as well as eliminating areas, accented letters, ampersands, and so on. With Eloquent-Sluggable you can easily develop slugs for all the Eloquent designs in your project.

class Post extends Eloquent
{
use Sluggable;
protected $fillable = ['title'];
public function sluggable() {
return [
'slug' => [
'source' => ['title']
]
];
}
}

$post = new Post([
'title' => 'My Awesome Blog Post',
]);
// $post->slug is "my-awesome-blog-post"

Migrations Generator

A Laravel bundle which can be made use of to generate migrations from an existing database, including indexes and foreign keys. When you run the adhering to command you could develop migrations for all the tables in your data source.

php artisan migrate:generate

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

php artisan migrate:generate table1,table2

NoCaptcha

Laravel 5 package for applying Google’s reCAPTCHA “reCAPTCHA” validation and also shielding your forms from spam. To use the solution you will need to acquire a complimentary API trick.

// prevent validation error on captcha
NoCaptcha::shouldReceive('verifyResponse')
->once()
->andReturn(true);
// provide hidden input for your 'required' validation
NoCaptcha::shouldReceive('display')
->zeroOrMoreTimes()
->andReturn('');

Artisan View

A command line utility that includes a number of Artisan commands for collaborating with the sights in your app. It enables you to automatically produce view layouts without having to manually generate new blade data.

# Create a view 'index.blade.php' in the default directory
$ php artisan make:view index

# Create a view 'index.blade.php' in a subdirectory ('pages')
$ php artisan make:view pages.index

# Add a section to the view
$ php artisan make:view index --section=content

Laravel Back-up

With this Laravel package you can support every one of the data in your task. All you need to do is run this command:

php artisan backup:run

It produces a zipfile with all the data in the directory and also a dump of your database. Can be saved on any kind of file system.

CORS Middleware

Establishing CORS (Cross-Origin Resource Sharing Headers) on your website can be a great deal of work. With this Laravel library the configuration process is really simplified. It takes care of CORS pre-flight options demands and includes CORS headers to your responses.

return [
'supportsCredentials' => false,
'allowedOrigins' => ['*'],
'allowedHeaders' => ['Content-Type', 'X-Requested-With'],
'allowedMethods' => ['*'], // ex: ['GET', 'POST', 'PUT', 'DELETE']
'exposedHeaders' => [],
'maxAge' => 0,
]

Laravel GraphQL

GraphQL is a data query language that offers an alternative to traditional REST architectures. Developers define the structure of the information required, as well as obtain precisely the same framework from the server. This bundle will help you set up as well as make use of GraphQL in your Laravel applications.

Laravel Mix

Laravel Mix supplies an abundant API for specifying Webpack build actions for your job. It uses a couple of common CSS as well as JavaScript pre-processors that could be chained with each other to transform and also format your assests.

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

Laravel Extended Generators

A collection by the team from Laracasts that offers a number of generators that could save you a great deal of time when creating your task. It allows you to quickly arrangement brand-new versions, sights, controllers, migrations, seeds, and also a lot more.

A library by the team from Laracasts that offers a number of generators that can save you a lot of time when developing your project. It allows you to quickly setup new models, views, controllers, migrations, seeds, and more.

Learn about the key features of Laravel 5 PHP Framework. Read tutorials, posts, and insights from top Laravel experts and developers for free.

--

--

KrishaWeb
KrishaWeb

Written by KrishaWeb

A Full-Service Digital Agency offering Web Design, UI UX Design, Open Source Development, Framework Development, and Digital Marketing to global clients.

Responses (2)