Download the PHP package didasto/apilot without Composer

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

Apilot — Rest API Package for Laravel

Rapid REST API development with model-based and service-based CRUD controllers, automatic OpenAPI 3.0.3 documentation, and a flexible hook system.

Features

Requirements

Installation

If your application does not use package auto-discovery, register the provider manually in config/app.php:

Publish the configuration file:

Quick Start

Model-based Controller

1. The Eloquent model (app/Models/Post.php):

2. The controller (app/Http/Controllers/Api/PostController.php):

3. The route (routes/api.php):

First request:

Service-based Controller

Use this approach when data lives outside your database — an external REST API, a legacy system, or a custom repository.

1. The service (app/Services/ProductService.php):

2. The controller (app/Http/Controllers/Api/ProductController.php):

3. The route:

Configuration

All options are in config/apilot.php:

Key Default Description
prefix 'api' Route prefix for all registered routes
middleware ['api'] Global middleware applied to all routes
pagination.default_per_page 15 Default items per page
pagination.max_per_page 100 Hard limit for per_page parameter
pagination.per_page_param 'per_page' Query parameter name
sorting.param 'sort' Query parameter name for sorting
filtering.param 'filter' Query parameter name for filtering
openapi.enabled true Enable/disable the /api/doc route
openapi.path 'doc' Path for the live spec (relative to prefix)
openapi.info.title APP_NAME . ' Documentation' OpenAPI spec title
openapi.info.version '1.0.0' OpenAPI spec version
openapi.default_security 'bearer' Security scheme: 'bearer', 'basic', 'apiKey', or null
openapi.export_path storage_path('app/openapi.json') Default export path for Artisan command

Filtering

Declare allowed filters in your controller:

Filter types:

Type SQL Example request
EXACT WHERE field = ? ?filter[status]=published
PARTIAL WHERE field LIKE %?% ?filter[title]=laravel
SCOPE Calls $query->fieldName($value) ?filter[status]=published

Empty filter values (?filter[status]=) are silently ignored.

Sorting

Declare allowed sort fields in your controller:

Request format: ?sort=field (ascending) or ?sort=-field (descending). Multiple fields: ?sort=status,-created_at.

Undeclared sort fields and array injections (?sort[]=title) are silently ignored.

Pagination

All index endpoints return paginated responses.

Response format:

Non-numeric or negative per_page values fall back to the configured default. The value is capped at max_per_page. Non-numeric or negative page values default to 1.

Hook System

Override any hook method in your controller to intercept or modify the CRUD lifecycle.

Hook Reference

Hook Called In Parameters Return Description
modifyIndexQuery index $query, $request mixed Modify the query before filtering/sorting
afterIndex index $result, $request mixed Transform the paginator after fetching
afterShow show $item, $request mixed Transform the item after fetching
beforeStore store $data, $request array Modify or enrich validated data before insert
afterStore store $item, $request mixed Post-process the newly created item
beforeUpdate update $item, $data, $request array Modify data before update
afterUpdate update $item, $request mixed Post-process the updated item
beforeDestroy destroy $item, $request bool Return false to abort deletion (responds 403)
afterDestroy destroy $item, $request void Run cleanup after deletion
transformResponse all except destroy $data, $action, $request mixed Final transformation of the response data
getStatusCode all $action int Override response status code per action

Hook Execution Order

index: modifyIndexQuery → filtering → sorting → pagination → afterIndex → resource mapping → transformResponse

show: afterShow → resource wrap → transformResponse

store: validation → beforeStore → model create → afterStore → resource wrap → transformResponse

update: find → validation → beforeUpdate → model update → afterUpdate → resource wrap → transformResponse

destroy: find → beforeDestroy (false = 403) → delete → afterDestroy

Example: Typical Hook Usage

OpenAPI Documentation

Live Spec

A live OpenAPI 3.0.3 spec is available at /api/doc (JSON) once routes are registered. Use it with Swagger UI:

Artisan Command

SDK generation example:

OpenAPI Attributes

#[OpenApiMeta] — Override the controller-level spec metadata:

#[OpenApiProperty] — Override schema properties derived from a FormRequest:

Middleware

ForceJsonResponse

By default, Laravel returns an HTML error page when a request is missing the Accept: application/json header. The ForceJsonResponse middleware prevents this by forcing the header on every request.

The middleware is registered as a named alias apilot.json and is not applied automatically. Apply it where needed:

CrudServiceInterface

Implement this interface when using ServiceCrudController:

PaginationParams carries $page (int) and $perPage (int).

PaginatedResult constructor: __construct(array $items, int $total, int $perPage, int $currentPage).

API Response Formats

Success Responses

200 — Single resource (show, update):

200 — Collection (index):

201 — Created resource (store):

204 — No content (destroy): Empty response body.

Error Responses

404 — Resource not found:

403 — Action not allowed (beforeDestroy returned false):

422 — Validation error:

Documentation

Full documentation is available in the docs/ directory:

Testing

Changelog

See CHANGELOG.md.

License

MIT. See LICENSE.


All versions of apilot with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^12.0|^13.0
illuminate/routing Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.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 didasto/apilot contains the following files

Loading the files please wait ...