Essentials

screenshot of Essentials

Just better defaults for your Laravel projects.

Overview

Essentials is a powerful package designed to enhance Laravel applications by providing better default behaviors and configurations. By introducing features like strict models, automatically eager loaded relationships, and immutable dates, it streamlines development processes and strengthens overall application integrity. Requiring PHP 8.3 and Laravel 11, Essentials modifies the standard Laravel experience, making it particularly suitable for new projects or those developers who are comfortable embracing its changes.

This package is all about improving the developer experience while leading to fewer bugs and clearer code. With various configurable options, Essentials allows developers to tailor the package to fit their specific needs and preferences, ultimately creating a more robust application.

Features

  • Strict Models: Enhances Eloquent's handling of undefined attributes and lazy loading, ensuring that accessing missing attributes throws an error and prevents silent failures.
  • Auto Eager Loading: Automatically eager loads relationships defined in the model's $with property, significantly reducing N+1 query issues and boosting performance.
  • Optional Unguarded Models: Offers the flexibility to disable mass assignment protection globally, making it a handy feature for trusted environments.
  • Immutable Dates: Utilizes CarbonImmutable instances to prevent unexpected date mutations, fostering improved predictability in date handling.
  • Force HTTPS: Guarantees that all generated URLs default to secure https:// connections, enhancing overall security for your application.
  • Safe Console: Blocks potentially destructive Artisan commands in production environments, which adds an important layer of protection against accidental data loss.
  • Asset Prefetching: Configures Laravel Vite to aggressively preload assets, leading to improved front-end load times and a better user experience.
  • Artisan Commands: Includes convenient commands such as make:action, which rapidly creates action classes to organize business logic, promoting cleaner and more maintainable code.