Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

essentials

> 编程语言
Open source

Just better defaults for your Laravel projects.

1.2K stars0 likes2 views
WebsiteGitHub

About

Just better defaults for your Laravel projects.

Essentials

Essentials provide better defaults for your Laravel applications including strict models, automatically eagerly loaded relationships, immutable dates, and more!

Requires PHP 8.3+, Laravel 11+.

Note: This package modifies the default behavior of Laravel. It is recommended to use it in new projects or when you are comfortable with the changes it introduces.

Installation

⚡️ Get started by requiring the package using Composer:

bash
composer require nunomaduro/essentials

Features

All features are optional and configurable in config/essentials.php.

You may publish the configuration file with:

bash
php artisan vendor:publish --tag=essentials-config

Table of Contents

  • Strict Models
  • Auto Eager Loading
  • Optional Unguarded Models
  • Immutable Dates
  • Force HTTPS
  • Safe Console
  • Asset Prefetching
  • Prevent Stray Requests
  • Fake Sleep
  • Artisan Commands
    • make:action
    • essentials:pint
    • essentials:rector

✅ Strict Models

Improves how Eloquent handles undefined attributes, lazy loading, and invalid assignments.

  • Accessing a missing attribute throws an error.
  • Lazy loading is blocked unless explicitly allowed.
  • Setting undefined attributes throws instead of failing silently.

Why: Avoids subtle bugs and makes model behavior easier to reason about.


⚡️ Auto Eager Loading

Automatically eager loads relationships defined in the model's $with property.

Why: Reduces N+1 query issues and improves performance without needing with() everywhere.


Optional Unguarded Models

Disables Laravel's mass assignment protection globally (opt-in).

Why: Useful in trusted or local environments where you want to skip defining $fillable.


Immutable Dates

Uses CarbonImmutable instead of mutable date objects across your app.

Why: Prevents unexpected date mutations and improves predictability.


Force HTTPS

Forces all generated URLs to use https://.

Why: Ensures all traffic uses secure connections by default.


Safe Console

Blocks potentially destructive Artisan commands in production (e.g., migrate:fresh).

Why: Prevents accidental data loss and adds a safety net in sensitive environments.


Asset Prefetching

Configures Laravel Vite to preload assets more aggressively.

Why: Improves front-end load times and user experience.


Prevent Stray Requests

Configures Laravel Http Facade to prevent stray requests.

Why: Ensure every HTTP calls during tests have been explicitly faked.


Fake Sleep

Configures Laravel Sleep Facade to be faked.

Why: Avoid unexpected sleep during testing cases.

️ Artisan Commands

make:action

Quickly generates action classes in your Laravel application:

bash
php artisan make:action CreateUserAction

This creates a clean action class at app/Actions/CreateUserAction.php:

php
 true,
    NunoMaduro\Essentials\Configurables\Unguard::class => false,
    // other configurables...
];

You may also publish the stubs used by this package:

bash
php artisan vendor:publish --tag=essentials-stubs

Roadmap

  • Better defaults before each test case
  • Better Pint configuration by default
  • General cleanup of the skeleton
  • Additional configurables for common Laravel patterns

License

Essentials was created by Nuno Maduro under the MIT license.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHP

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言