I. Auth

laravel/sanctum: Laravel Sanctum provides a featherweight authentication system for SPAs (single page applications), mobile applications, and simple, token based APIs. Sanctum allows each user of your application to generate multiple API tokens for their account. These tokens may be granted abilities / scopes which specify which actions the tokens are allowed to perform.

Routes can be protected like this

Route::middleware(['auth:sanctum'])->group(function () {
  // routes

Login 419 error: "CSRF token mismatch"

php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan view:clear
php artisan optimize:clear

II. API documentation

knuckleswtf/scribe: Scribe helps you generate API documentation for humans from your Laravel/Lumen/Dingo codebase. See a live example at

If you use php artisan serve, knuckleswtf/scribe is available on /docs, like localhost:8000/docs. You can set parameters into each Controller, check to know more, like this


 * @group Author
 * Endpoint to get Authors data.
class AuthorController extends Controller
   * GET Author collection
   * <small class="badge badge-blue">WITH PAGINATION</small>
   * You can get all Authors with alphabetic order on lastname with pagination.
   * @queryParam perPage int Entities per page, '32' by default. No-example
   * @queryParam page int The page number, '1' by default. No-example
   * @responseFile public/assets/responses/authors.index.get.json
  public function index(Request $request)
    // ...

Generate documentation

php artisan scribe:generate

III. Code linter

IDE helper

barryvdh/laravel-ide-helper: to generate magic methods for each model to help IDE completion

composer helper


nunomaduro/larastan: Adds static analysis to Laravel improving developer productivity and code quality.

php artisan larastan

PHP CS Fixer

friendsofphp/php-cs-fixer: A tool to automatically fix PHP Coding Standards issues

composer helper

IV. Database and models

  • fakerphp/faker: Faker is a PHP library that generates fake data for you


spatie/laravel-enum: Laravel support for spatie/enum

Media library

spatie/laravel-medialibrary: Associate files with Eloquent models. If you update registerMediaConversions() in any Model, you can regenerate conversions

php artisan media-library:regenerate


spatie/laravel-tags: Add tags and taggable behaviour to your Laravel app

V. Tools

Browser Sync

To enable or disable Browser Sync, just change variable in .env



itsgoingd/clockwork: Clockwork is a development tool for PHP available right in your browser. Clockwork gives you an insight into your application runtime - including request data, performance metrics, log entries, database queries, cache queries, redis commands, dispatched events, queued jobs, rendered views and more - for HTTP requests, commands, queue jobs and tests.

To use Clockwork, you have to install browser extension: Chrome or Firefox. When it's done, just open DevTools and choose Clockwork.


fruitcake/laravel-cors: Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application




spatie/array-to-xml: A simple class to convert an array to xml


spatie/laravel-route-attributes: Use PHP 8 attributes to register routes in a Laravel app


Only available on routes/web.php

  • laravel/telescope: Telescope makes a wonderful companion to your local Laravel development environment. Telescope provides insight into the requests coming into your application, exceptions, log entries, database queries, queued jobs, mail, notifications, cache operations, scheduled tasks, variable dumps, and more.
  • fruitcake/laravel-telescope-toolbar: A toolbar for Laravel Telescope, based on the Symfony Web Profiler.

To enable Telescope, just change variable in .env


Note: only useful in local

You can use laravel/telescope on the application at http://localhost:8000/telescope if you serve project with php artisan serve (adapt URL if you have VHost).

VI. Tests

php artisan migrate --database=testing

You can run Pest and PHP Unit tests

php artisan pest:run
Edit this page on GitHub Updated at Tue, Apr 12, 2022