PHPackages                             pawanyd/global-crud - 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. pawanyd/global-crud

ActiveLibrary[Framework](/categories/framework)

pawanyd/global-crud
===================

A Global CRUD package for Laravel

01PHP

Since Jan 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/pawanyd/global-curd)[ Packagist](https://packagist.org/packages/pawanyd/global-crud)[ RSS](/packages/pawanyd-global-crud/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Global CRUD Package
===================

[](#global-crud-package)

A Laravel package that provides a **single controller** (`GlobalController`) to handle **CRUD** operations for **multiple models**, using **dynamic** form generation and **dynamic** index listings. This setup significantly reduces boilerplate when building CRUD features for different entities.

Features
========

[](#features)

- **Single GlobalController** for all CRUD routes
- **Dynamic form fields** using database schema introspection
- **Automatic listing** of columns in the index view
- **Pagination** for large datasets
- **Success messages** on create, update, and delete
- Supports **Tailwind** or any CSS framework for easy styling

Requirements
============

[](#requirements)

- **PHP** &gt;= 8.0
- **Laravel** &gt;= 10.x (compatible with 11.x as well)

Ensure you have a functional Laravel project with database connectivity set up before installing this package.

Installation
============

[](#installation)

1. **Install via Composer**```
    composer require pawanyd/global-crud:dev-main
    ```
2. **Publish the stubs**```
    php artisan global-crud:install

    or

    php artisan vendor:publish --tag=global-crud-stubs
    ```

These commands will copy:

- GlobalController.php into app/Http/Controllers
- index.blade.php, create.blade.php, edit.blade.php into resources/views

---

Configuration
=============

[](#configuration)

1. Add Routes
-------------

[](#1-add-routes)

In `routes/web.php`:

```
use App\Http\Controllers\GlobalController;

Route::get('/{model}', [GlobalController::class, 'index'])->name('global.index');
Route::get('/{model}/create', [GlobalController::class, 'create'])->name('global.create');
Route::post('/{model}', [GlobalController::class, 'store'])->name('global.store');
Route::get('/{model}/{id}', [GlobalController::class, 'show'])->name('global.show');
Route::get('/{model}/{id}/edit', [GlobalController::class, 'edit'])->name('global.edit');
Route::put('/{model}/{id}', [GlobalController::class, 'update'])->name('global.update');
Route::delete('/{model}/{id}', [GlobalController::class, 'destroy'])->name('global.destroy');
```

You can prefix these routes (e.g., /admin/{model}) to avoid collisions with other routes.

2. Verify the Published Files
-----------------------------

[](#2-verify-the-published-files)

- app/Http/Controllers/GlobalController.php
- resources/views/global-curd/index.blade.php
- resources/views/global-curd/create.blade.php
- resources/views/global-curd/edit.blade.php ``

---

Usage
=====

[](#usage)

1. Creating Models
------------------

[](#1-creating-models)

```
php artisan make:model ModelName
```

Create Eloquent models (e.g., `User`, `Post`, `Product`) in `app/Models`.
No need to define `$fillable` if using `forceFill()`.

2. Access the Global CRUD
-------------------------

[](#2-access-the-global-crud)

- **Index**: `GET /{model}`
- **Create**: `GET /{model}/create`
- **Store**: `POST /{model}`
- **Edit**: `GET /{model}/{id}/edit`
- **Update**: `PUT /{model}/{id}`
- **Destroy**: `DELETE /{model}/{id}`

For instance, `GET /user` lists `User` records; `GET /user/create` opens the create form.

3. Dynamic Fields
-----------------

[](#3-dynamic-fields)

The table schema is introspected:

- `varchar/text` → text input
- `tinyint(1)` → checkbox
- `enum` → select dropdown
- `date` → date input
- `int` → number input

4. Pagination
-------------

[](#4-pagination)

By default, `GlobalController` uses:

```
$items = $modelClass::paginate(10);
```

Adjust the 10 as needed. Blade uses {{ $items-&gt;links() }} for pagination links.

---

Troubleshooting
===============

[](#troubleshooting)

1. **Class Not Found**

    - Ensure your namespace in `src/GlobalCrudServiceProvider.php` matches `composer.json` PSR-4.
2. **MassAssignmentException**

    - The stubs use `forceFill()` to bypass `$fillable`. Removing it requires `$fillable` or `Model::unguard()`.
3. **Publishing Issues**

    - If `php artisan global-crud:install` does nothing, try: ```
        php artisan vendor:publish --tag=global-crud-stubs --force
        ```
    - Verify stubs are copied to `app/Http/Controllers` and `resources/views`.

Contributing
============

[](#contributing)

1. **Fork** this repository.
2. **Create a feature branch** for your changes.
3. **Commit** and **push** your changes.
4. Open a **Pull Request** describing your modifications.

Your contributions, bug reports, and feature requests are always welcome!

License
=======

[](#license)

This package is released under the [MIT License](LICENSE).

You are free to use, modify, and distribute this package in both commercial and personal projects as permitted by the MIT license.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

Top contributor holds 75% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/39417779270ff85beb37ff1b7a7aab07b6b15d3579b79ac79f738b13480e17b1?d=identicon)[pawanyd](/maintainers/pawanyd)

---

Top Contributors

[![pawanyd](https://avatars.githubusercontent.com/u/20682269?v=4)](https://github.com/pawanyd "pawanyd (3 commits)")[![pawanyd14](https://avatars.githubusercontent.com/u/51370030?v=4)](https://github.com/pawanyd14 "pawanyd14 (1 commits)")

### Embed Badge

![Health badge](/badges/pawanyd-global-crud/health.svg)

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

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M190](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M256](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M591](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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