Download the PHP package dandoetech/laravel-generic-api without Composer

On this page you can find all versions of the php package dandoetech/laravel-generic-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-generic-api

Laravel Generic API

Pre-release — Architecture by senior tech lead, implementation largely AI-assisted with human review. Not fully reviewed. Architecture may change before v1.0.0.

Registry-driven CRUD controller for Laravel. One controller handles all resources — validation, authorization, filtering, sorting, pagination, and computed fields are derived from the Resource Registry.

Installation

The service provider is auto-discovered. Publish the config:

Requires dandoetech/laravel-resource-registry.

Quick Start

Define a resource with HasEloquentModel (and optionally HasPolicy):

Routes are registered automatically. The API is ready:

Routes

All routes are prefixed with config('ddt_api.prefix') (default: api/v1) and use the api middleware plus AuthorizeResource.

Method Route Action
GET {resource} List with pagination, filtering, sorting
POST {resource} Create
GET {resource}/{id} Show
PATCH {resource}/{id} Update (partial)
DELETE {resource}/{id} Delete
POST {resource}/actions/{action} Execute mass action

Responses

List:

Single item:

Query Syntax

Only fields listed in filterable() and sortable() on the resource are accepted. Unknown fields return a 422 Unprocessable Entity. This includes computed fields — filtering and sorting on category_name or orders_count works out of the box.

Filtering

Operators: eq, neq, gt, gte, lt, lte, like, between

Sorting

Search

Search applies LIKE %term% for string fields and exact match for non-string fields.

Pagination

Query Profiles

Override filterable/sortable/searchable per context. Profiles can be defined on the Resource class:

Activate with ?profile=admin or ?profile=active.

Authorization

The AuthorizeResource middleware handles authorization automatically for resources that implement HasPolicy:

Request Gate ability Subject
GET (list) viewAny Model class
GET (single) view Model instance
POST create Model class
PATCH update Model instance
DELETE delete Model instance
Mass action action Model class + action name

Resources without HasPolicy skip authorization entirely.

Validation

Validation rules are derived from the resource definition:

Configuration

config/ddt_api.php:

Testing

License

MIT


All versions of laravel-generic-api with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^11.0 || ^12.0
illuminate/routing Version ^11.0 || ^12.0
illuminate/validation Version ^11.0 || ^12.0
illuminate/auth Version ^11.0 || ^12.0
illuminate/contracts Version ^11.0 || ^12.0
illuminate/http Version ^11.0 || ^12.0
illuminate/database Version ^11.0 || ^12.0
dandoetech/resource-registry Version ^0.1 || ^0.2
dandoetech/laravel-resource-registry Version ^0.1 || ^0.2
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 dandoetech/laravel-generic-api contains the following files

Loading the files please wait ...