Skip to content

Getting Started โ€‹

Quick Start โ€‹

bash
# 1. Install the package
composer require mylekha/record-api

# 2. Generate/publish configs (record/audit/record-api)
php artisan record-api:setup

# 3. Publish package migrations + run migrations
php artisan vendor:publish --tag=record-api-migrations
php artisan migrate

# 4. Define rate limiters in your AppServiceProvider (see below)

# 5. Configure at least 1 table in config/record.php (see below) or scaffold a table config via the record command

# 6. Test a public read endpoint
curl -X GET http://your-app.test/api/v1/users

AI Assistants โ€‹

The package ships AI guidelines and skills in resources/boost. With Laravel Boost installed, run php artisan boost:install (or boost:update) and select mylekha/record-api: your coding assistant then learns how to configure tables, hooks and functions, and how to call the API.

Agents calling a running app can read /{api_prefix}/docs/llms.txt and the OpenAPI spec at /{api_prefix}/docs/openapi.json. The documentation itself is available to agents at https://record-api-docs.vercel.app/llms.txt.

Features โ€‹

  • ๐Ÿ”„ Dynamic API Controller: Full CRUD operations for any database table with advanced filtering
  • ๐Ÿš€ Upsert Support: Atomic update-or-create operations with configurable matching logic
  • ๐Ÿ“Š Standardized API Responses: Consistent JSON response format across your application
  • ๐Ÿ” QueryHelpers Trait: Powerful trait for advanced query filtering and manipulation
  • ๐Ÿ“ Audit Logging: Comprehensive audit trail for all data changes with queue-based processing
  • ๐Ÿ” Permission System: Optional Spatie Laravel Permission integration for role-based access control
  • ๐Ÿ”‘ Authentication Driver Agnostic: Works with any Laravel auth guard (JWT, Sanctum, Passport, etc.)
  • ๐Ÿ“š OpenAPI Spec Generation: CLI command to generate API documentation
  • ๐ŸŽฏ Request ID Middleware: Automatic request tracking for debugging and monitoring
  • โšก Performance Optimized: Query caching and lazy loading
  • ๐Ÿงน Audit Log Cleanup: CLI command for cleaning old audit logs based on retention policy
  • ๐Ÿข Multi-Tenant Ready: Built-in support for tenant isolation
  • ๐Ÿ”ง Configuration Publishing: Easy setup with sensible defaults

Requirements โ€‹

  • PHP: 8.2 or higher
  • Laravel: 12.x
  • Database: MySQL 8.0+, PostgreSQL 13+, or SQLite 3.8+
  • Extensions: BCMath, Ctype, JSON, Mbstring, OpenSSL, PDO, Tokenizer, XML

Dependencies and Optional Integrations โ€‹

Core dependency installed with the package:

  • Carbon (^2.0 or ^3.0) - Date manipulation library

Optional integrations you can install in your application:

  • Spatie Laravel Permission (^6.21) - Role and permission management
  • PHP Open Source Saver JWT Auth (^2.8.2) - JSON Web Token authentication (install/configure in your app)

Released under the MIT License.