Download the PHP package cr0w/phorq without Composer

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

⎇ phorq

File-based routing for PHP

Your directory structure is your URL structure. Dynamic params, catch-alls, middleware, and modules all work out of the box.

Install

Quick start

Front controller

Pass an optional context as the first argument to thread shared state through middleware and route files:

$ctx can be anything — a plain object, an array, a service container. phorq doesn't inspect it.

Routing conventions

File / directory Matches
index.php Directory root
about.php /about
[id].php Dynamic segment /42, $id available
[id]/settings/index.php /42/settings, $id available
[...rest].php Catch-all, $rest is array of segments
[[...rest]].php Optional catch-all file
[[...rest]]/index.php Optional catch-all directory

Method branching

Handle different HTTP methods inside the route file using $req:

Catch-all routes

A catch-all ([...rest].php or [...rest]/index.php) captures one or more remaining path segments into an array variable. It only matches when at least one segment is present — /docs alone will not match docs/[...rest].php.

An optional catch-all ([[...rest]].php or [[...rest]]/index.php) also matches the bare directory. /pages matches with $rest = [], and /pages/a/b matches with $rest = ['a', 'b'].

Precedence

  1. Exact static match (about.php)
  2. Dynamic param ([id].php)
  3. Catch-all ([...rest].php)

Static directories are walked before dynamic or catch-all directories.

Modules

Each subdirectory of the modules folder is a module. A module can have:

The core module is special:

Route files

Every route file receives these variables:

$req is a phorq\Request with typed accessors:

Route files can return any value. The front controller decides what to do with it:

Middleware

Trailing parameters you don't need can be omitted:

Middleware stacking order: core → module → handler.

Caching

Pass a cache file path to Router::create() and the route map is written once, then loaded from cache on subsequent requests. Delete the file to rebuild.

Omit the second argument (or pass null) to disable caching during development.

Testing

Running the example

Then visit:

License

MIT


All versions of phorq with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
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 cr0w/phorq contains the following files

Loading the files please wait ...