Download the PHP package apex/router without Composer

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

Apex Router

Light weight, easy to understand and use HTTP router that also comes fully and optionally integrated with the Syrus template engine, essentially turning it into a cool little micro framework. Not meant for heavy lifting, but excellent if you just need something well structured up and running quickly. Supports the following:

Installation

Install via Composer with:

composer require apex/router

Table of Contents

  1. Base Configuration
  2. Routes YAML File
  3. Middleware Classes
  4. Router Functions
  5. Syrus Template Engine Integration

Basic Usage

For a quick example, check the example.php script that comes with this package.

First, add some routes to your YAML file:

routes:
    default: Syrus
    members: MembersArea
    contact$: ContactPage
    "product/:category/:product_id": PathParamsExample
use Apex\Router\Router;
use Nyholm\Psr7Server\ServerRequestCreator;
use Nyholm\Psr7\Factory\Psr17Factory;
use League\Uri\Http;

require_once("./vendor/autoload.php");

// Define a uri to test with
$uri = Http::createFromString("http://example.com/category/cars");

// Generate PSR7 compliant server request object
$factory = new Psr17Factory();
$creator = new ServerRequestCreator($factory, $factory, $factory, $factory);
$request = $creator->fromGlobals()->withUri($uri);

// Handle http request via router
$router = new Router();
$response = $router->handle($request);

// If this is handled via Syrus auto-routing, the 
// HTML would have already been output to the user. 
// Otherwise, $response is a PSR7 ResponseInterface object.

// Alternatively, we can use the lookup method
$response = $router->lookup($request);

// This simply determines the route, obtains any dynamic path parameters, 
// and instantiates the middleware, but does not execute the process() method within it.
// Instead, $response is a Apex\Router\RouterResponse instance.

// Now, to execute the middle wear and output:
$router->execute($response, true);

Support

If you have any questions, issues or feedback, please feel free to drop a note on the ApexPl Reddit sub for a prompt and helpful response.


All versions of router with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
apex/syrus Version ^2.0
nyholm/psr7-server Version ^1.0
nyholm/psr7 Version ^1.5
psr/http-server-handler Version ^1.0
psr/http-server-middleware Version ^1.0
symfony/yaml Version ^6.2
apex/container Version ^2.0
psr/container Version ^2.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 apex/router contains the following files

Loading the files please wait ....