Download the PHP package rizkussef/laravel-crud-api without Composer

On this page you can find all versions of the php package rizkussef/laravel-crud-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-crud-api

🚀 Laravel CRUD Api Package

[![Latest Version on Packagist](https://img.shields.io/packagist/v/rizkussef/laravel-crud-api.svg?style=flat-square)](https://packagist.org/packages/rizkussef/laravel-crud-api) [![Total Downloads](https://img.shields.io/packagist/dt/rizkussef/laravel-crud-api.svg?style=flat-square)](https://packagist.org/packages/rizkussef/laravel-crud-api) [![License](https://img.shields.io/packagist/l/rizkussef/laravel-crud-api.svg?style=flat-square)](LICENSE)

A clean, scalable Api CRUD architecture for Laravel, built around a reusable Base Service and Base Controller with automatic:

Designed to eliminate repetitive CRUD logic while keeping your application clean and maintainable. Pass filters and relationships directly from your frontend to dynamically build optimized queries with full control over data retrieval.


📦 Installation

Install via Composer:

If needed, manually register the provider in:


⚙️ Publish Configuration

This will publish:

Example:


🏗 Architecture


⚡ Artisan Generator Command

The absolute fastest way to get started is by using the built-in Artisan generator. This powerful command scaffolds a fully functional CRUD API endpoint in seconds!

🎯 Example: Creating an Article API

What happens behind the scenes? The command automatically generates all layers required for an API CRUD operation:

Layer Generated File Description
Model App\Models\Article.php The Eloquent model (along with its database migration).
Resource App\Http\Resources\ArticleResource.php Automatically serializes and formats your JSON response.
Requests App\Http\Requests\ArticleRequest.php
ArticleUpdateRequest.php
Dedicated Form validation classes (Auto-validated by Controller).
Service App\Services\ArticleService.php Core business logic layer (Extends ApiCrudService).
Controller App\Http\Controllers\ArticleController.php Handles routing and formatting (Extends ApiCrudController).

⚙️ Available Options

Option Description Example
--no-migration Tells the generator to skip database migration file creation. php artisan api-crud:make User --no-migration

Once generated, just register your new endpoint in routes/api.php and you're fully operational!


🛠 Manual Setup (Step-by-Step)

1️⃣ Create a Service

🔎 Automatic Resolution (Models, Resources, and Form Requests)

The architecture heavily relies on naming conventions to automatically resolve dependencies:

No need to manually inject or define the Model, Resource, or Form Requests. ApiCrudController automatically validates inbound requests using the resolved Form Request before passing data to the Service.


2️⃣ Create a Controller

Just Inject the specific service for this controller.


� Filters & Relationships

The package includes powerful filtering and eager-loading capabilities. Pass filters and relationships from the frontend to dynamically build queries. They can be passed either as array parameters or as JSON-encoded strings.

Available Filter Operators

Comparison Operators

String Matching

Array Operations

NULL Checks

Date Operations

Frontend Examples

Axios Example

Backend Services Examples

Another Service Calling This Service


�🔁 Built-in CRUD Methods

The BaseCrudController provides:

Controller handles validation & response formatting. All business logic is handled inside ApiCrudService.


📄 Automatic Resource Handling

Single Item

Collection

Automatically handled by the base service.

No Resource

If the corresponding Resource class does not exist, the base controller will return the raw model data instead of a resource.


📊 Example JSON Response

GET /users


🧠 Best Practices

✔ Use the Artisan Generator Command to create all layers automatically.
✔ Keep business logic inside Model-specific services.
✔ Keep controllers thin.
✔ Extend ApiCrudService instead of modifying it.
✔ Use Resources for API formatting.
✔ Use filters and relationships to avoid N+1 query problems.

Example 1: Simple Business Logic with Filters

Example 2: Complex Filtering with Date Range

Example 3: Filtering with NULL Checks

🔌 Dependency Injection

ApiCrudService is bound in the container via the Service Provider, so it can be injected anywhere.


🔧 Extending

You can extend:

And you can use:


🛣 Example Routes


👨‍💻 Author & Support

Developed by Rizk Ussef

A fullstack developer passionate about creating clean, maintainable architecture patterns and reusable solutions for building scalable applications across frontend and backend ecosystems.

Get in Touch


🤝 Contributing

Contributions are welcome! If you find bugs or have feature suggestions, please open an issue or submit a pull request.


📄 License

MIT License - see LICENSE file for details.


All versions of laravel-crud-api with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rizkussef/laravel-crud-api contains the following files

Loading the files please wait ...