Download the PHP package jasonej/laravel-endpoints without Composer

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

Laravel Endpoints

Single file endpoints for Laravel.

Latest Version on Packagist Total Downloads Tests

A typical Laravel endpoint is spread across a route, a form request, and a controller. laravel-endpoints collapses all three into a single auto-discovered class: extend Endpoint, declare the route with an attribute, and handle the request in __invoke. Add rules() to validate and authorize() to gate access, just like a form request.

Installation

You can install the package via composer:

You can publish the config file with:

Usage

Defining an endpoint

Extend Endpoint, declare a route with an attribute, and handle the request in __invoke. No need to register it in routes/api.php as endpoints are auto-discovered.

HTTP method attributes

There is one attribute per verb (#[Get], #[Post], #[Put], #[Patch], #[Delete], and #[Options]) plus a raw #[Route] for an explicit or multi-verb set. Route names accept a string or a BackedEnum.

The attributes are repeatable, so you can point several routes at a single handler:

Route options

Every attribute forwards the full set of route options:

Option Type Maps to
name string\|BackedEnum ->name()
middleware array ->middleware()
withoutMiddleware array ->withoutMiddleware()
wheres array<string, string> ->where()
domain string ->domain()
scopeBindings bool ->scopeBindings() / ->withoutScopedBindings()

Handling the request

Read input with the typed accessors (string(), integer(), boolean(), enum(), array(), all(), …), or collect it into a DTO. Route-model-bound parameters are injected into __invoke just like any controller action, and you can return an array, a resource, or a response.

Validation and authorization

Both are optional hooks that work just like a form request. Define rules() (with messages() and attributes() to customize) to validate input, and authorize() to gate access. Validation runs when the endpoint is resolved, and a failing authorize() throws a 403.

Configuration and discovery

The package scans the paths in config/endpoints.php for classes extending Endpoint. Publish the config to change where it looks:

Endpoints can live anywhere under a configured path.

Route caching in production

Discovery reflects over the filesystem on every request that is not route-cached. In production, cache your routes so discovery runs once at build time instead of on every request:

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

Please see CONTRIBUTORS for more information on who contributed to the package.

License

The MIT License (MIT). Please see LICENSE for more information.


All versions of laravel-endpoints with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3||^8.4||^8.5
illuminate/contracts Version ^13.0
illuminate/routing Version ^13.0
illuminate/support Version ^13.0
illuminate/validation Version ^13.0
spatie/php-attribute-reader Version ^1.1
spatie/php-structure-discoverer Version ^2.4
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 jasonej/laravel-endpoints contains the following files

Loading the files please wait ...