8 Laravel must-have packages to install when you start a new API-Based Project
Nowadays in modern web development, API-based project is popular pattern to create service that can be accessed via mobile or website. Laravel is one of best framework to create API-based project, it offers speed development with a large community around the world. Laravel built in project includes composer that allow you to add some packages to make development faster. Here is several useful packages must-have to install when you decide to start new API-based project.
Debugging is important process in development, by identifying a problem, isolating the source of the problem, and then either correcting the problem. Laravel debugbar is a package that allows you to quickly and easily debug your application during development. This is a package to integrate PHP Debug Bar with Laravel 5. It includes a ServiceProvider to register the debugbar and attach it to the output. The package can be found here.
Authentication is the process of verifying who you are, determine user identity after login process. For the simplicity, you should use JWT as a standart method for authenticating process. JWT (JSON Web Token) is a compact, URL-safe means of representing claims to be transferred between two parties. Here is popular package for jwt in laravel.
ACL (Access Control List) is a set operation who tells a system which access rights for each users. ACL contains roles and permissions to manage access for specific user. Laravel comes with default ACL named Gate. Gate is name of classes and facades, but in my opinion Gate is little bit difficult, so lets go to packagist and find some simple package for manage ACL. There are so many packages for ACL, zizaco/entrust is most popular ACL package for laravel, you should go for it.
The important thing in API-based project is API response data output. Laravel comes with bundle ORM named Eloquent who has default data output as json or array. If you create response from one or two tables it doesn’t matter, but what if your response populate from five or more tables, it’s so painful. Fractal is solution to create pretty response for your API. Fractal provides a presentation and transformation layer for complex data output. Spatie/laravel-fractal comes with facades for easy integration into laravel project.
UUID (Universally Unique IDentifier) is a set of 128 bits chacarcter, containing letters and numbers. Each set is unique, guarantee uniqueness across space and time, you can read more about it here. UUID can secure your system when user accessing data. Webpatser/laravel-uuid is laravel package to generate a UUID according to the RFC 4122 standard, you can found this project here.
Intervention Image is a PHP image handling and manipulation library providing an easier and expressive way to create, edit, and compose images. The package includes ServiceProviders and Facades for easy Laravel integration.
Push notifications are instant text messages that are sent directly to the user’s mobile display screen. Push notifications also increase engagement rates and improve user retention rates. Thus, not only can they help drive activity on the topic of your message, they also help increase the returns you see from your app. Davibennun/laravel-push-notification is an easiest package to sending push notifications to devices. They support push notification service in APNS (apple) and GCM (google).
The last important thing in your project is always backup your data. There is laravel package named laravel-backup that create a backup of your application. The backup is a zipfile that contains all files in the directories you specify along with a dump of your database. The backup can be stored on any of the filesystems you have configured in your project. You can backup your application to multiple filesystems at once.
“Tell me and I forget. Teach me and I remember. Involve me and I learn.” ~ Benjamin Franklin