PHPackages                             kareemtarek/crud-pack - 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. [Admin Panels](/categories/admin)
4. /
5. kareemtarek/crud-pack

ActiveLibrary[Admin Panels](/categories/admin)

kareemtarek/crud-pack
=====================

A comprehensive full-stack CRUD scaffolding framework layer built on a reusable Laravel CRUD generator → Controllers (Web/API), FormRequests (validation), Models, Migrations, Policies (multiple auth styles), Views (Blades), Routes (Web/API), Postman collection (from API routes).

v0.1.0(2mo ago)159MITPHPPHP ^8.0

Since Feb 22Pushed 2mo agoCompare

[ Source](https://github.com/Kareem-Tarek/crud-pack)[ Packagist](https://packagist.org/packages/kareemtarek/crud-pack)[ RSS](/packages/kareemtarek-crud-pack/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

 [![Laravel CrudPack ToolKit logo](assets/logo/logo-dark.png)](assets/logo/logo-dark.png)

\[0.1.0\] - Initial Release
---------------------------

[](#010---initial-release)

### Added

[](#added)

- Single Artisan command `crud:make` for CRUD generation
- Support for Web and API controllers
- Mandatory controller type and soft-delete mode selection
- Optional generators:
    - Routes (web/api)
        - For api routes (`routes/api.php`): Ready API documentation Postman collection (.json) is being created (and also updated) when creating a new api resource. When the developer creates another api resource then this api resource will be automatically appended to the created Postman collection to be ready for import in Postman as an API end-points (path: `postman/CrudPack.postman_collection.json`)
    - Eloquent model
    - Migration
    - Form request (store + update)
        - The same form request (e.g., ProductRequest) will work for the request validation for both methods (store &amp; update)
    - Policy
    - Blade views (Web only)
        - Ready-blades with responsive design for the CRUD operations for any created resource with also a ready-logic within those blades UI/UX is handled
        - Displaying the total count of the rows per resource in the Ready-blades (e.g., Products (73), Trashed (18), etc.)
        - The blades are **fully dynamic per resource**, they **respect policy-style** (authorization style) automatically
            - Blades: `index`, `show`, `create`, `edit`, `trash`
            - Authorization styles: `none` (default), `authorize`, `gate`, `resource`
        - Added placeholder authentication section in `resources/views/layouts/navigation.blade.php` \[including authenticated user and unauthenticated user (guest)\]. They’re currently commented out to support projects without authentication. If authentication is later added (e.g., Breeze or Jetstream with Fortify, UI, custom authentication, etc.), you can simply uncomment them.
    - Ready-blade pagination components (Bootstrap 5, Bootstrap 4, tailwind, default, etc.)
- Shared delete-handling trait generated once per application
- Soft delete workflows:
    - Trashed listing (partially deleted resources)
    - Restore (single &amp; bulk)
    - Force delete (single &amp; bulk)
- Bulk delete support
- Blueprint-first design (no hidden logic, no magic)
- Bootstrap 5–based Blade views
- Interactive wizard mode
- Full Laravel naming convention compliance
- Compatibility with PHP 8.0+ and Laravel 8.0+

### Notes

[](#notes)

- This is the first stable release.
- All generated code is intended to be edited and customized by developers.

---

Note

**Attention❗**
--------------

[](#attention)

This is important, but you can read it later.

**Let’s jump to the core topic:**

👉 **[CLICK HERE](#get-started)**
--------------------------------

[](#-click-here)

### Some considerations needs to be addressed (optional you could read later):

[](#some-considerations-needs-to-be-addressed-optional-you-could-read-later)

#### API scaffold safety for Laravel 11+

[](#api-scaffold-safety-for-laravel-11)

- When generating `--api` resources, CrudPack ensures API routing is available by running Laravel’s php artisan `install:api` *only if* routes/api.php does not exist.
- If `routes/api.php` already exists, CrudPack *skips* running **install:api** silently (no prompt, no overwrite risk). This keeps the API scaffolding a **one-time setup step** per project.
- Note (**Laravel 11+**): `routes/api.php` and API route registration (inside **bootstrap\\app.php**) are **not included** or **not registered by default** in a fresh Laravel project install. API routing is now “optional scaffolding”, so the first --api generation may need to scaffold it.

    - **Sub-Note:** In Laravel 10 and below: The fresh Laravel project install comes automatically with "routes/api.php" and "API route registration" by default

#### Postman collection automation for API resources

[](#postman-collection-automation-for-api-resources)

- When generating any `--api` resource, CrudPack creates `postman/CrudPack.postman_collection.json` if missing.
- For additional `--api` resources, CrudPack updates (**upserts**) the same collection by adding/updating the resource folder — it **does not wipe/replace** unrelated content.

#### `crud:postman` command

[](#crudpostman-command)

- A dedicated command that generates/updates the Postman collection from **CRUDPACK blocks** in `routes/api.php`.
- Supports `--force` to rebuild **only CrudPack-generated folders** (safe rebuild).

#### Index actions UI improvement (Web views)

[](#index-actions-ui-improvement-web-views)

- In generated `index.blade.php` and `show.blade.php`
    - Delete button becomes dynamic based on soft deletes mode:
        - Soft deletes enabled → **“Move To Trash”** behavior
        - Soft deletes disabled → **“Permanently Delete”** behavior

#### Default authorization shortcut

[](#default-authorization-shortcut)

- When `--policy` is enabled and `--policy-style` is not provided, the default behavior is `policy-style = none` (logic-first; no authorization wiring unless the developer chooses).

Policy authorization styles (Note):

- none
- authorize
- gate
- resource

**These topics will already be discussed below ⬇️ later on!**
-------------------------------------------------------------

[](#these-topics-will-already-be-discussed-below-️-later-on)

---

⬇️ Lets get started ✨🚀
======================

[](#️-lets-get-started-)

CRUD Pack `(kareemtarek/crud-pack)`
===================================

[](#crud-pack-kareemtarekcrud-pack)

CRUD Pack is a comprehensive **Full-Stack CRUD Scaffolding Framework Layer** for Laravel that automates the entire CRUD lifecycle, allowing developers to scaffold complete CRUD resources (Web or API) using a single Artisan command while strictly following Laravel conventions.

It is designed to eliminate repetitive boilerplate **without hiding logic**, **without magic**, and **without locking developers into abstractions**. Everything generated by CRUD Pack is readable, editable, and intended to be owned and customized by the developer.

CRUD Pack includes first-class support for:

- Soft deletes
- Bulk operations
- Trashed listings (partially deleted resources)
- Restore workflows
- Force-delete workflows

All delete-related behavior is implemented in a **shared, reusable way**, ensuring consistency across the entire application.

---

Why CRUD Pack Exists
--------------------

[](#why-crud-pack-exists)

Most Laravel CRUD generators fall into one of two categories:

1. **Overly magical generators**
    These hide logic, abstract behavior too aggressively, and make customization difficult.
2. **Minimal stub generators**
    These save very little time and leave all real-world concerns to the developer.

CRUD Pack intentionally sits between these two extremes.

It generates a **complete, real-world CRUD blueprint** that:

- Follows Laravel conventions strictly
- Handles real application needs (soft deletes, bulk actions, restore flows)
- Keeps all logic explicit and visible (commented &amp; uncommented components)
- Encourages customization instead of hiding behavior
- Handles many operations dynamically through CLI (interactive wizard mode)
- Supports full-stack features (**MVC Web**) and also back-end (**RESTful API**)

The goal is **speed without sacrificing control**.

---

Requirements
------------

[](#requirements)

- **PHP:** 8.0 and higher
- **Laravel:** 8.0 and higher
    - Developed and tested on **PHP 8.4.17 (NTS)** &amp; **Laravel 12**
    - Fully compatible with Laravel 8.0+

---

Installation
------------

[](#installation)

To install the package issue this command:

```
composer require kareemtarek/crud-pack
```

After installing the package run the following install command:

```
php artisan crud:install
```

This `crud:install` command scaffolds all of the following...

- **layout views**:

    - `resources/views/layouts/app.blade.php`
    - `resources/views/layouts/navigation.blade.php`
    - `resources/views/welcome.blade.php` (**Don’t skip this!** — Make sure you read this page after running the local development server `php artisan serve`.)
- **Laravel pagination views**:

    - `resources\views\vendor\pagination\ALL_PAGINATION_BLADES`
- **Assets (within the `resources/views/layouts/app.blade.php`)**:

    - Bootstrap 5 CDN (CSS &amp; JS)
    - Font Awesome 7.0.1 CDNJS (CSS &amp; JS)
    - @stack('styles') and @stack('scripts')
- **Config**:

    - `config\crud-pack.php`

To override all the previous scaffolded files (without prompts):

```
php artisan crud:install --force
```

Lets jump into the package instructions ⤵️
------------------------------------------

[](#lets-jump-into-the-package-instructions-️)

Core Concept
------------

[](#core-concept)

CRUD Pack is centered around one single Artisan command and one resource name.

From that resource name, CRUD Pack automatically derives everything else according to Laravel conventions, including:

- Model names
- Table names
- Controller classes
- Route URIs and route names
- View directories
- Variable names

This guarantees:

- Consistency across the application
- Predictable structure
- Zero naming ambiguity

---

Command Overview
----------------

[](#command-overview)

```
php artisan crud:make ResourceName
```

This command always generates a "controller" (wether web or api) and can optionally generate:

- Routes
- Eloquent model
- Migration
- Request validation
- Policy
- Blade views (Web controllers only)

The command requires two mandatory decisions and supports optional generators through flags or an interactive wizard.

---

Resource Name Rules
-------------------

[](#resource-name-rules)

The resource name is the foundation of everything CRUD Pack generates and must strictly follow Laravel conventions.

### Rules

[](#rules)

- Must be singular
- Must be StudlyCase
- Must NOT include suffixes like Controller, Model, Request, etc.

### Valid Examples ✅

[](#valid-examples-)

```
php artisan crud:make Category
php artisan crud:make Product
php artisan crud:make ProductCategory
```

### Invalid Examples ❌

[](#invalid-examples-)

```
php artisan crud:make categories
php artisan crud:make category
php artisan crud:make product_categories
```

**Note:**

- If you entered "category" instead of "Category", that will also generate it correctly (as "Category") everywhere in the project with the name conventions in Laravel
- Also, if you entered "product\_category" instead of "ProductCategory", that will also generate it correctly (as "ProductCategory") everywhere in the project with the name conventions in Laravel
- So, the **Invalid Examples** will convert to the **Valid Examples**. But you should use the names singularly in studly case with no suffixes
    - Ex: `Employee`, `Department`, `HouseComponent`, `OrderItem`, `FoodRecipe`, `StudentCourseEnrollment`, `CustomerOrder`, etc.

From this single resource name, CRUD Pack dynamically derives:

ItemResultModel`App\Models\Category`Table`categories`Controller (Web)`App\Http\Controllers\CategoryController`Controller (API)`App\Http\Controllers\Api\CategoryController`Route URI`/categories`Route names`categories.*`Variables`$category, $categories`Views folder`resources/views/categories`---

Mandatory Decisions (Always Required)
-------------------------------------

[](#mandatory-decisions-always-required)

Every execution of the command requires **two mandatory decisions**. These are **never optional** and must be resolved before generation proceeds.

### 1) Controller Type

[](#1-controller-type)

Choose exactly one:

- --web → Web controller (Blade views, redirects, sessions)
- --api → API controller (JSON responses only)

### 2) Soft Delete Mode

[](#2-soft-delete-mode)

Choose exactly one:

- --soft-deletes
- --no-soft-deletes

These decisions can be passed as flags or selected interactively.

### Example

[](#example)

```
php artisan crud:make Category --web --soft-deletes
```

If either decision is missing, CRUD Pack will prompt the developer to choose.

---

### Publish the config file

[](#publish-the-config-file)

Publish the package config into your Laravel app:

CRUD Pack ships with a default configuration file that controls things like the navbar CRUD resources dropdown (which resources appear, their labels/routes, and whether a resource shows a Trash link when Soft Deletes are enabled) in the **resources\\views\\layouts\\navigation.blade.php**.

To copy the config file into your Laravel app (so you can customize it), publish it using:

```
php artisan vendor:publish --tag=crud-pack-config
```

This will create:

- `config/crud-pack.php`After publishing, edit `config/crud-pack.php` to define your resources and menu behavior

---

Optional Generators
-------------------

[](#optional-generators)

In addition to the controller (which is always generated), CRUD Pack can optionally generate:

OptionDescription`--routes`Append routes to `routes/web.php` or `routes/api.php``--model`Generate an Eloquent model`--migration`Generate a migration`--request`Generate a single FormRequest (used for store &amp; update)`--policy-style`Generate a policy and wire authorization`--views`Generate Blade views (Web only)---

CRUD Pack provides a convenience shortcut:

The --policy-style= Shortcut (default "none")
---------------------------------------------

[](#the---policy-style-shortcut-default-none)

- --policy-style=none (no policy is used) \[default\]
- --policy-style=authorize (adds use AuthorizesRequests and $this-&gt;authorize(...))
- --policy-style=gate (\\Illuminate\\Support\\Facades\\Gate::authorize(...))
- --policy-style=resource (uses authorizeResource() but only if compatible)

---

The --all Shortcut
------------------

[](#the---all-shortcut)

```
php artisan crud:make Category --web --soft-deletes --all
```

### Behavior of --all

[](#behavior-of---all)

#### Web controller

[](#web-controller)

- routes
- model
- migration
- request
- policy
- views

#### API controller

[](#api-controller)

- routes
- model
- migration
- request
- policy
- **never generates views**

### Important Rules

[](#important-rules)

- `--all` is **exclusive**
- It cannot be combined with any other generator flags
- Invalid combinations cause a **hard error** and stop execution

---

Wizard Mode (Interactive Prompts)
---------------------------------

[](#wizard-mode-interactive-prompts)

If the developer:

- does not pass `--all`
- and does not explicitly pass any optional generator flags

CRUD Pack enters **wizard mode** and prompts the developer with yes/no questions:

- Generate routes? (default: yes)
- Generate model? (default: yes)
- Generate migration? (default: yes)
- Generate request validation? (default: no — **some developers prefer handling validation inside controllers or via custom patterns**)
- Generate policy? (default: no — **authorization approaches vary and may be custom and that depends on the developer's deceison**)
- Generate views? (web only; default: yes)

If the controller type is API, the views prompt is **never shown**.

---

Shared Delete-Handling Trait (Created Once Per App)
---------------------------------------------------

[](#shared-delete-handling-trait-created-once-per-app)

CRUD Pack uses **one shared delete-handling trait** across the entire application.

### Trait Location

[](#trait-location)

```
app/Traits/HandlesDeletes.php
```

#### To create (if not existing)/replace (if existing) the HandlesDeletes.php trait with prompting \[and that is for any updates made from the package, and if you want to recreate the file to pull the same original again or any updated logic\] + including soft-delete &amp; non-soft-deletes methods

[](#to-create-if-not-existingreplace-if-existing-the-handlesdeletesphp-trait-with-prompting-and-that-is-for-any-updates-made-from-the-package-and-if-you-want-to-recreate-the-file-to-pull-the-same-original-again-or-any-updated-logic--including-soft-delete--non-soft-deletes-methods)

```
php artisan crud:trait
```

**Note:** This is automatically generated when creating a **web**/**api** controller for the very first time in the project

#### Same as above (`php artisan crud:trait`), but using this command to overwrite existing HandlesDeletes.php trait without prompting

[](#same-as-above-php-artisan-crudtrait-but-using-this-command-to-overwrite-existing-handlesdeletesphp-trait-without-prompting)

```
php artisan crud:trait --force
```

### Behavior

[](#behavior)

- The trait is generated **once per Laravel application**
- On the first CRUD generation, the trait is created
- On subsequent CRUD generations:
    - The trait is detected
    - Creation is skipped
    - A message is printed indicating it already exists

This ensures:

- No duplicated delete logic
- One consistent delete blueprint
- Reusable behavior across all controllers

---

Delete &amp; Soft-Delete Endpoints (Trait Methods)
--------------------------------------------------

[](#delete--soft-delete-endpoints-trait-methods)

All delete-related endpoints live **directly inside the trait** (path: **app\\Traits\\HandlesDeletes.php**), not in controllers (but using it (the **HandlesDeletes.php** trait) inside the controllers).

### Methods Provided

[](#methods-provided)

`destroy` — single record delete (resource method) `destroyBulk` — bulk delete `trash` — list soft-deleted records `restore` — restore single record `restoreBulk` — restore multiple records `forceDelete` — permanently delete single record `forceDeleteBulk` — permanently delete multiple records

### Important Rules

[](#important-rules-1)

- `destroy` and `destroyBulk` is **always active**
- The other six methods are soft-delete related 1\] performDestroy
    - this is related to the controller (resource methods) but, the core logic is written here since in the "`app\Traits\HandlesDeletes.php`" has all the delete methods **--soft-deletes** and **--no-soft-deletes**2\] performDestroyBulk 3\] trash 4\] restore 5\] restoreBulk 6\] forceDelete 7\] forceDeleteBulk
- The trait (`app\Traits\HandlesDeletes.php`) always contains real logic (**the 7 methods mentioned above**)
- Methods are enabled/disabled via **routes**, not by modifying the trait
- Responses automatically adapt:
    - JSON for API
    - Redirects + flash messages for Web

---

Soft Delete Behavior (Blueprint-First Design)
---------------------------------------------

[](#soft-delete-behavior-blueprint-first-design)

When route generation is enabled:

### If `--soft-deletes` is selected

[](#if---soft-deletes-is-selected)

- All soft-delete routes are generated active
- trash (Deleted) listing, restore, force delete, and bulk operations work immediately

### If `--no-soft-deletes` is selected

[](#if---no-soft-deletes-is-selected)

- Soft-delete routes are still generated
- They are commented out
- This provides a visible blueprint developers can enable later

Nothing is hidden. Nothing is removed.

---

Routes Generation
-----------------

[](#routes-generation)

If route generation is enabled:

### Main CRUD Route (Single Line)

[](#main-crud-route-single-line)

#### Web

[](#web)

```
Route::resource('categories', CategoryController::class);
```

#### API

[](#api)

```
Route::apiResource('categories', Api\CategoryController::class);
```

This covers all standard CRUD actions, including **single-record destroy**.

### Additional Delete Routes

[](#additional-delete-routes)

Generated explicitly:

- **destroyBulk** (destroy/delete multiple resource at once)
- **trash** (the blade/page that has the deleted resources by the soft-delete)
- **restore** (restore action for a single soft-deleted resource)
- **restoreBulk** (restore action for a multiple soft-deleted resources)
- **forceDelete** (permanent destroy/delete action for a single soft-deleted resource)
- **forceDeleteBulk** (permanent destroy/delete action for a multiple soft-deleted resources)

These routes are:

- Appended to the correct routes file (web or api, based on the option entered in the CLI)
- Wrapped with clear start/end markers (Comments)
- Enabled or commented based on soft-delete choice (dynamic to the selected soft-delete option in the CLI)

---

Blade Views (Web Controllers Only)
----------------------------------

[](#blade-views-web-controllers-only)

When views are enabled, CRUD Pack generates **Bootstrap 5–based Blade templates**:

- index (listing + bulk actions)
- create
- edit
- show
- `_form` (shared with create &amp; edit blades)
- trash (soft-deleted records)

Note:

- All of the blades will be in that location `resources/views/resource_name_plural/BLADES_HERE`, except for the "**\_form.blade.php**" will be in that location "`resources/views/resource_name_plural/partials`"
    - Example: `resources/views/products/BLADES_HERE` and `resources/views/products/partials/_form.blade.php`

### View Features

[](#view-features)

- Checkbox selection + select-all
- Single &amp; bulk actions (delete actions)
- Confirmation prompts
- Validation error display
- Proper old() handling
- Clean, minimal, production-ready layout

---

Request Validation
------------------

[](#request-validation)

If request generation is enabled:

- A single FormRequest is generated
- Used for both `store` and `update`
- Handles unique validation correctly with ignore logic

---

Policies
--------

[](#policies)

If policy generation is enabled:

- A policy is generated following Laravel conventions
- Authorization is wired into the controller constructor

If no policy is generated: -The controller constructor remains empty -No authorization logic is injected

---

Example Commands
----------------

[](#example-commands)

### Web CRUD with everything

[](#web-crud-with-everything)

```
php artisan crud:make Category --web --soft-deletes --all
```

### API CRUD with everything

[](#api-crud-with-everything)

```
php artisan crud:make Product --api --no-soft-deletes --all
```

### Interactive wizard

[](#interactive-wizard)

```
php artisan crud:make Department
```

---

Philosophy &amp; Customization
------------------------------

[](#philosophy--customization)

CRUD Pack exists to:

- Remove repetitive CRUD boilerplate
- Provide a professional, realistic starting point
- Preserve full developer control

All generated code is:

- Readable
- Editable
- Replaceable

You are never locked in.

---

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance83

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

86d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d3eb85b317666f4867ad363a22b4fef6d289ab71ad5e5b6ffd0a3f276d25cff?d=identicon)[Kareem-Tarek](/maintainers/Kareem-Tarek)

---

Top Contributors

[![Kareem-Tarek](https://avatars.githubusercontent.com/u/95657621?v=4)](https://github.com/Kareem-Tarek "Kareem-Tarek (147 commits)")

---

Tags

laravelgeneratorscaffoldartisanlaravel-packagecrudsoft deletesbulk actions

### Embed Badge

![Health badge](/badges/kareemtarek-crud-pack/health.svg)

```
[![Health](https://phpackages.com/badges/kareemtarek-crud-pack/health.svg)](https://phpackages.com/packages/kareemtarek-crud-pack)
```

###  Alternatives

[brackets/admin-generator

Laravel 8 CRUD generator for brackets/craftable

50190.9k](/packages/brackets-admin-generator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
