delboy1978uk/bone-http

HTTP package for Bone Framework

Installs: 1 526

Dependents: 6

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 1

Language:HTML

v2.5.0 2024-10-25 11:40 UTC

README

Latest Stable Version Total Downloads Latest Unstable Version License
build status Code Coverage Scrutinizer Code Quality

Http Middleware stack and HAL middleware for Bone Framework.

installation

This is a core package of Bone Framework. It is installed by default.

usage

middleware stack

To add application wide middleware that will run pre-routing, just add your middleware class into your config/middleware.php file. For instance, to use the delboy1978uk/bone-firewall middleware:

<?php

use Bone\Firewall\RouteFirewall;

return [
    'stack' => [
        RouteFirewall::class,
    ],
];

You can add middleware of course to the router's stack, either on a group of routes or an individual route.

bundled middleware

This package comes with two middleware classes for representing HAL links for an API. For a single entity, you can use the Bone\Http\Middleware\HalEntity, and for an array you can use the Bone\Http\Middleware\HalCollection.

adding your own middlware to a package

If your package class implements Bone\Http\MiddlewareRegistrationInterface you can return an array of middlewares and it will be added by the Bone Application to the container