Download the PHP package bitshost/php-crud-api-generator without Composer

On this page you can find all versions of the php package bitshost/php-crud-api-generator. 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 php-crud-api-generator

PHP CRUD API Generator

Expose your MySQL/MariaDB database as a secure, flexible, and instant REST-like API.
Features optional authentication (API key, Basic Auth, JWT, OAuth-ready),
OpenAPI (Swagger) docs, and zero code generation.


πŸš€ Features

πŸ“– See detailed enhancement documentation β†’ πŸ“– Rate Limiting Documentation β†’ πŸ“– Request Logging Documentation β†’ πŸ“– Quick Start (5 minutes) β†’ πŸ”Œ Integration with upMVC Framework β†’ - NEW! Full-stack power combo βš–οΈ Comparison with PHP-CRUD-API v2 β†’ - NEW! Detailed feature comparison and when to use each πŸ—ΊοΈ Feature Roadmap β†’ - NEW! Upcoming features and integrations


πŸ”’ SECURITY WARNING

⚠️ CRITICAL: The admin dashboard (dashboard.html) and health endpoint (health.php) expose sensitive information and MUST BE PROTECTED before deploying to production!

These files reveal:

πŸ›‘οΈ SECURE YOUR DASHBOARD NOW β†’ - Complete protection guide

Quick Fix (5 minutes): Add IP whitelist to .htaccess (Apache 2.4+):


πŸ“¦ Installation

Option 1: Install as Library (Recommended) ⚑

Just 4 simple steps:

That's it! Total modifications: 2 lines of code πŸš€

πŸ“– 5-Minute Quick Start Guide β†’ πŸ”’ Secure Your Dashboard β†’ ← DO THIS BEFORE PRODUCTION!

Option 2: Standalone Project (Even Simpler!)

Download complete ready-to-use project:

That's it! Everything in one folder, ready to run. 0 lines to modify πŸš€


βš™οΈ Configuration

If installed as library (via composer require):

Edit config files in vendor directory:

If standalone project (via composer create-project):

Copy and edit config files:


Config file structure:

Edit config/db.php:

Edit config/api.php:

Environment variables (.env)

For easier secret management and 12-factor style deployments, the project also supports a root-level .env file.


πŸ”’ Security Setup (Production)

⚠️ IMPORTANT: This framework ships with example credentials for development.
You MUST change these before deploying to production!

Quick Security Setup:

What to Change:

πŸ“– Full security guide: docs/AUTHENTICATION.md



πŸ” Authentication Modes

Configure in config/api.php:

πŸ“– Complete Authentication Guide β†’ - Detailed examples with Postman, HTTPie, cURL (JSON, Form Data, Multipart)


πŸ“š API Endpoints

All requests go through public/index.php with action parameter.

Action Method Usage Example
tables GET /index.php?action=tables
columns GET /index.php?action=columns&table=users
list GET /index.php?action=list&table=users
count GET /index.php?action=count&table=users
read GET /index.php?action=read&table=users&id=1
create POST /index.php?action=create&table=users (form POST or JSON)
update POST /index.php?action=update&table=users&id=1 (form POST or JSON)
delete POST /index.php?action=delete&table=users&id=1
bulk_create POST /index.php?action=bulk_create&table=users (JSON array)
bulk_delete POST /index.php?action=bulk_delete&table=users (JSON with ids)
openapi GET /index.php?action=openapi
login POST /index.php?action=login (JWT only)

πŸ€– Example curl Commands


πŸ’ͺ Bulk Operations

The API supports bulk operations for efficient handling of multiple records:

Bulk Create

Create multiple records in a single transaction. If any record fails, the entire operation is rolled back.

Endpoint: POST /index.php?action=bulk_create&table=users

Request Body (JSON array):

Response:

Bulk Delete

Delete multiple records by their IDs in a single query.

Endpoint: POST /index.php?action=bulk_delete&table=users

Request Body (JSON):

Response:


πŸ“Š Count Records

Get the total count of records in a table with optional filtering. This is useful for analytics and doesn't include pagination overhead.

Endpoint: GET /index.php?action=count&table=users

Query Parameters:

Examples:

Response:


πŸ”„ Advanced Query Features (Filtering, Sorting, Pagination, Field Selection)

The list action endpoint now supports advanced query parameters:

Parameter Type Description
filter string Filter rows by column values. Format: filter=col:op:value or filter=col:value (backward compatible). Use , to combine multiple filters.
sort string Sort by columns. Comma-separated. Use - prefix for DESC. Example: sort=-created_at,name
page int Page number (1-based). Default: 1
page_size int Number of rows per page (max 100). Default: 20
fields string Select specific fields. Comma-separated. Example: fields=id,name,email

Filter Operators

Operator Description Example
eq or : Equals filter=name:eq:Alice or filter=name:Alice
neq or ne Not equals filter=status:neq:deleted
gt Greater than filter=age:gt:18
gte or ge Greater than or equal filter=price:gte:100
lt Less than filter=stock:lt:10
lte or le Less than or equal filter=discount:lte:50
like Pattern match filter=email:like:%@gmail.com
in In list (pipe-separated) filter=status:in:active|pending
notin or nin Not in list filter=role:notin:admin|super
null Is NULL filter=deleted_at:null:
notnull Is NOT NULL filter=email:notnull:

Examples:

Response:


πŸ“ OpenAPI Documentation (Swagger)

Your API automatically generates OpenAPI 3.0 documentation!

Get the OpenAPI Specification (JSON)

View Interactive Documentation (Swagger UI)

Option 1: Online Swagger Editor (Quick & Easy)

  1. Copy JSON from: http://localhost:8000/index.php?action=openapi
  2. Paste into: https://editor.swagger.io/
  3. See beautiful interactive documentation!

Option 2: Use dashboard.html (Recommended) Your project includes dashboard.html which has API documentation built-in:

Example OpenAPI Path Structure

This is what the specification includes for /index.php?action=list&table={table}:

Note: The YAML above is just an example of the structure. The actual API returns JSON format.

πŸ›‘οΈ Security Notes

πŸ“– Rate Limiting Documentation β†’ πŸ“– Request Logging Documentation β†’


πŸ§ͺ Running Tests


πŸ”— Working with Related Data (Client-Side Joins)

Your API provides all the data you need - it's up to the client to decide how to combine it. This approach gives you maximum flexibility and control.

Current approach: Fetch related data in separate requests and combine on the client side.

Quick Example: Get User with Posts

Optimization: Use IN Operator for Batch Fetching

Parallel Fetching for Performance

πŸ“– See complete client-side join examples β†’

Why this approach?

Future: Auto-join/expand features may be added based on user demand.


πŸ—ΊοΈ Roadmap


πŸ“„ License

MIT


πŸ™Œ Credits

Built by BitHost. PRs/issues welcome!



All versions of php-crud-api-generator with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
firebase/php-jwt Version ^6.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 bitshost/php-crud-api-generator contains the following files

Loading the files please wait ...