Download the PHP package tetes-de-pioche/laravel-modular-api without Composer

On this page you can find all versions of the php package tetes-de-pioche/laravel-modular-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-modular-api

Laravel Modular API

Key Features:

Version support

Installation

You can install the package via composer:

If you want to use obfuscated ids (short, non-sequential identifiers derived from your primary keys) for your resources, you can install the required package via composer:

If you want to customize the configuration, you can publish the config file:

This is the contents of the published config file:

Getting started

Services directory structure:

Querying

Two builder macros implement the JSON:API request contract on any Eloquent query:

jsonApiPaginate() takes an optional default and maximum page size, to raise the cap on a bounded-cardinality resource that may be fetched in a single page:

jsonApiFind() decodes the identifier when the obfuscated ids feature is enabled, and raises a ResourceNotFoundException when nothing matches.

Both are registered on Illuminate\Database\Eloquent\Builder, so query builder packages forwarding unknown calls to their underlying builder — spatie/laravel-query-builder among them — pick them up with no extra wiring.

Obfuscated IDs

The feature is optional: install sqids/sqids to use it. Enabling it without the package raises a FeatureInvalidException.

When the feature is enabled, ApiResource exposes Sqids identifiers instead of raw primary keys, and BaseRequest decodes them back before validation runs. Sqids has no salt of its own: the package derives a project-specific alphabet from a deterministic, key-seeded shuffle, so two applications with different keys never produce the same identifier for the same row.

Opt a resource out with:

Encoding is handled by Features\ObfuscatedIdEncoder, bound as a singleton. Bind your own implementation to change the strategy:

Errors

Error responses are negotiated on the Accept header, so adopting the package on an existing API does not break its consumers.

A client sending Accept: application/vnd.api+json gets JSON:API error objects, with the matching Content-Type:

Any other client keeps the Laravel shape:

source follows the request document assembled by BaseRequest: a validation key matching a route parameter is reported as source.parameter, every other key as a /data/attributes pointer with dots as nested segments.

The package renders framework exceptions (ValidationException, NotFoundHttpException) as API responses only for API requests, so web endpoints keep the default Laravel behaviour. Its own BaseException is always rendered as an API response.

License

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


All versions of laravel-modular-api with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/contracts Version ^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 tetes-de-pioche/laravel-modular-api contains the following files

Loading the files please wait ...