PHPackages                             fleet-tower/essentials - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. fleet-tower/essentials

ActiveLibrary[Framework](/categories/framework)

fleet-tower/essentials
======================

Just better defaults for your Laravel projects.

v1.1.0(7mo ago)0246↓50%MITPHPPHP ^8.4CI passing

Since Oct 2Pushed 7mo agoCompare

[ Source](https://github.com/fleet-tower/essentials)[ Packagist](https://packagist.org/packages/fleet-tower/essentials)[ Fund](https://www.paypal.com/paypalme/enunomaduro)[ GitHub Sponsors](https://github.com/nunomaduro)[ RSS](/packages/fleet-tower-essentials/feed)WikiDiscussions v1.x Synced 1mo ago

READMEChangelog (1)Dependencies (9)Versions (3)Used By (0)

Essentials
==========

[](#essentials)

 [![Build Status](https://camo.githubusercontent.com/02e69fcbdab74d0a76763536ffb6a178f14284799d92769f435a378d6146eecb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f666c6565742d746f7765722f657373656e7469616c732f74657374732e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d7465737473)](https://github.com/fleet-tower/essentials/actions/workflows/tests.yml) [![Total Downloads](https://camo.githubusercontent.com/afc6b742b36ba079c09435e4956d565eefb4df04e9fa11628ea2b2210bb169f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666c6565742d746f7765722f657373656e7469616c733f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/fleet-tower/essentials) [![Latest Stable Version](https://camo.githubusercontent.com/43698ef4545fe073405a0262c99796244f5595ad4fff07e8bb0710a01fcc0874/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666c6565742d746f7765722f657373656e7469616c733f7374796c653d666f722d7468652d6261646765266c6f676f3d5061636b6167697374)](https://packagist.org/packages/fleet-tower/essentials) [![License](https://camo.githubusercontent.com/6993bb367b5c3dd8120efd2913e6f4b7042a8edb66cbcc09d7a6b80353c0e060/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f666c6565742d746f7765722f657373656e7469616c733f7374796c653d666f722d7468652d626164676526636f6c6f723d626c7565)](https://packagist.org/packages/fleet-tower/essentials)

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

### Notice

[](#notice)

This package is a **modified clone** of the original work by **[Nuno Maduro](https://github.com/nunomaduro/essentials)** and their contributors.
All credit and recognition belong to the original creator(s).

The purpose of this fork is to:

- Remove unused functionalities that are not required in our environment.
- Ensure the package remains available and versioned within our company repository for long-term stability and security, regardless of potential future changes or removal from the original source.
- Apply a namespace change strictly to reflect the internal usage and maintenance of this version, without implying ownership of the original work.

This repository is **not an official distribution** of the original package. We encourage developers to use and support the **official package** whenever possible.

> **Requires [PHP 8.4+](https://php.net/releases)**, **[Laravel 12+](https://laravel.com/docs/12.x)**.

> **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
------------

[](#installation)

⚡️ Get started by requiring the package using [Composer](https://getcomposer.org):

```
composer require fleet-tower/essentials
```

Features
--------

[](#features)

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

You may publish the configuration file with:

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

Table of Contents
-----------------

[](#table-of-contents)

- [Strict Models](#-strict-models)
- [Auto Eager Loading](#-auto-eager-loading)
- [Optional Unguarded Models](#-optional-unguarded-models)
- [Immutable Dates](#-immutable-dates)
- [Force HTTPS](#-force-https)
- [Safe Console](#-safe-console)
- [Asset Prefetching](#-asset-prefetching)
- [Prevent Stray Requests](#-prevent-stray-requests)
- [Fake Sleep](#-fake-sleep)
- [Artisan Commands](#-artisan-commands)
    - [make:action](#makeaction)

### ✅ Strict Models

[](#-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

[](#️-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

[](#-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

[](#-immutable-dates)

Uses `CarbonImmutable` instead of mutable date objects across your app.

**Why:** Prevents unexpected date mutations and improves predictability.

---

### 🔒 Force HTTPS

[](#-force-https)

Forces all generated URLs to use `https://`.

**Why:** Ensures all traffic uses secure connections by default.

---

### 🛑 Safe Console

[](#-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

[](#-asset-prefetching)

Configures Laravel Vite to preload assets more aggressively.

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

---

### 🔄 Prevent Stray Requests

[](#-prevent-stray-requests)

Configures Laravel Http Facade to prevent stray requests.

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

---

### 😴 Fake Sleep

[](#-fake-sleep)

Configures Laravel Sleep Facade to be faked.

**Why:** Avoid unexpected sleep during testing cases.

### 🏗️ Artisan Commands

[](#️-artisan-commands)

#### `make:action`

[](#makeaction)

Quickly generates action classes in your Laravel application:

```
php artisan make:action CreateUserAction
```

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

```
