Download the PHP package ibekzod/microcrud without Composer

On this page you can find all versions of the php package ibekzod/microcrud. 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 microcrud

MicroCRUD Banner

Total Downloads Latest Stable Version License PHP Version

MicroCRUD

MicroCRUD is a comprehensive Laravel package that eliminates boilerplate code and accelerates API development. Build production-ready RESTful APIs in minutes with advanced features like type-aware filtering, intelligent caching, queue support, and automatic validation.

Why MicroCRUD?

Stop writing the same CRUD logic over and over. MicroCRUD provides:

Table of Contents

Requirements

Requirement Version
PHP ^7.0 | ^8.0 | ^8.1 | ^8.2 | ^8.3
Laravel 5.2 - 12.x

Installation

Install the package via Composer:

The package will automatically register itself via Laravel's package discovery.

Publish Assets (Optional)

Publish configuration files and translations:

This will create:

Quick Start

Create a complete CRUD API in 3 steps:

Step 1: Create Your Model

Step 2: Create Your Service

Step 3: Create Your Controller

Step 4: Register Routes

Option 1: Use Route Macros (Recommended - all POST endpoints):

This creates 7 POST endpoints:

Option 2: RESTful Routes (Standard Laravel):

That's it! You now have a fully functional API with:

Architecture

MicroCRUD follows the Service-Repository-Controller pattern with a focus on separation of concerns:

Component Breakdown

Component Purpose File Location
Model Eloquent ORM models Microcrud\Abstracts\Model
Service Business logic & operations Microcrud\Abstracts\Service
Controller HTTP handling & routing Microcrud\Http\CrudController
Resource API response transformation Microcrud\Responses\ItemResource
Middleware Request preprocessing Microcrud\Middlewares\*
Jobs Background processing Microcrud\Abstracts\Jobs\*
Exceptions Error handling Microcrud\Abstracts\Exceptions\*

Core Concepts

Services

Services contain all business logic. The base Service class provides:

Controllers

Controllers handle HTTP requests and delegate to services:

Resources

Resources transform model data for API responses:

Route Macros

MicroCRUD provides convenient Route macros for registering CRUD resources:

With Middleware & Prefix:

Benefits:


Features

Dynamic Filtering

MicroCRUD automatically detects column types and provides intelligent filtering:

String Columns → LIKE Search

Numeric Columns → Exact Match + Range

Date Columns → Exact Match + Range

Boolean Columns → Exact Match

Dynamic Sorting

Dynamic Grouping

Group results by model columns or relation columns:

Simple Grouping:

Grouped Pagination (Top N per Group):

Mixed Syntax (Simple + Configured):

Features:

Response Structure:

The response format depends on whether hierarchical is enabled:

1. Flat Grouped Response (hierarchical: false or not set)

Basic (returns first record per group - non-deterministic):

With Aggregate Selection (deterministic):

Method 1: Top-level parameters

Method 2: Inline syntax (recommended)

Both return newest apartment per object

Or use group_aggregate shortcuts:

Response (flat list with standard pagination):

2. Hierarchical Grouped Response (hierarchical: true)

Basic example:

With aggregations and inline ordering:

Returns nested structure (group → children):

Comparison Table:

Feature Flat (hierarchical: false) Hierarchical (hierarchical: true)
Structure [{...}, {...}] [{group: {...}, data: [...]}, ...]
Parent Data Repeated in each record Once per group
Records per Group 1 (configurable with group_aggregate) ALL
Pagination Paginates individual records Paginates groups
Relations Included (normal behavior) Auto-excluded from children
Aggregate Selection group_aggregate, group_order_by N/A
Use Case Standard listing, latest/oldest per group Parent-child navigation
Performance Good for simple lists Better for complex hierarchies

3. With Aggregation - Add selectRaw() in beforeIndex() for COUNT/SUM/AVG/MAX/MIN 4. Top N per Group - Use window functions (see Performance Guide) 5. With Relations - Automatically eager loads relations (no N+1)

Example Response (with aggregation):

Example Model Setup:

Pagination

Combining Filters

Validation System

Validation rules are auto-generated from your database schema:

Auto-Generated Rules Based on Column Types:

Plus automatic range validation:

Caching

Enable intelligent caching with automatic invalidation:

Manual cache control:

Queue Jobs

Process heavy operations in the background:

Available Jobs:

Job Features:

Bulk Operations

Process multiple records efficiently:

Bulk Features:

Soft Deletes

Full soft delete support with easy restoration:

Hooks & Events

Add custom logic at any point in the lifecycle:

Available Hooks:

API Documentation

Standard Response Format

Success Response (Single Item)

Success Response (Paginated List)

Error Response (Validation)

Error Response (Not Found)

HTTP Status Codes

Method Endpoint Success Status Description
GET /products 200 OK List products
GET /products/{id} 200 OK Get single product
POST /products 201 Created Create product
PUT /products/{id} 202 Accepted Update product
DELETE /products/{id} 202 Accepted Delete product
POST /products/{id}/restore 202 Accepted Restore product
POST /products/bulk 202 Accepted Bulk operation

Error Status Codes

Status Code Method Description
400 errorBadRequest() Bad Request
401 errorUnauthorized() Unauthorized
403 errorForbidden() Forbidden
404 errorNotFound() Not Found
422 errorValidation() Validation Error
500 error() Internal Server Error

Advanced Usage

Custom Resources

Create custom transformations for your API responses:

Use in controller:

Transaction Management

Transactions are enabled by default. Control them per service:

Custom Query Scopes

Add custom query modifications:

Preventing N+1 Queries

Eager load relationships to prevent N+1 queries:

Without Global Scopes

Remove global scopes temporarily:

Parent-Child Relationships

For hierarchical data like categories or organizational structures:

Usage:

Auto-cascade delete:

HTTP Client Service

Make external API calls with the built-in HTTP client:

Middleware

LocaleMiddleware

Automatically sets application locale from Accept-Language header:

Request:

Behavior:

TimezoneMiddleware

Sets timezone from Timezone header:

Request:

Default: Uses config('microcrud.timezone', 'UTC')

LogHttpRequest

Logs all HTTP requests with URL, headers, and parameters:

Logs to Laravel's default log channel.

Configuration

config/microcrud.php

config/schema.php

For PostgreSQL multi-schema support:

Environment Variables

Add to your .env:

Examples

Complete E-commerce Product API

API Usage Examples

Testing

While the package doesn't include a test suite, here's how to test your implementations:

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Setup

Coding Standards

Changelog

[Latest] - 2025-01-30

Added

Improved

Previous Releases

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


Made with ❤️ by iBekzod

PackagistGitHubIssues


All versions of microcrud with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0|^8.1|^8.2|^8.3
illuminate/database Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/filesystem Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/http Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
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 ibekzod/microcrud contains the following files

Loading the files please wait ...