Download the PHP package brain/cortex without Composer

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

Cortex

Travis CI codecov.io MIT license


Cortex is routing system for WordPress based on FastRoute

Start using Cortex

First of all ensure Composer autoload is loaded.

After that "boot" Cortex:

This can be done as soon as you can, no need to wrap in a hook.

It will not work after 'do_parse_request' has been fired.

Adding routes

To add routes, it is possible to use 'cortex.routes' hook, that passes an instance of RouteCollectionInterface:

The route pattern (1st argument) syntax is inherited from FastRoute.

The callback passed as second argument receives the array of matches ($routeInfo[2] in FastRoute) and has to return an array of arguments for WP_Query.

QueryRoute arguments

QueryRoute constructor accepts as 3rd argument an array of options for route configuration.

One of them is "template" to force WordPress use a template when the route matches:

As shown above,template argument can be a relative path to theme (or child theme) folder.

To use a template that resides outside theme folder, template argument need to be full absolute path to the template file to use.

There are other arguments, among them:

Route groups

A route group is a way to share common settings among routes.

Before assign groups to routes, we need to add groups.

That can be done using 'cortex.groups' hook, that pass an instance of GroupCollectionInterface:

A group is instantiated passing an array of values to its constructor. The value "id" is required. All other values are optional, and can be used to set any route property (array items in 3rd param of QueryRoute constructor).

To use properties from a group in a route, the group id has to be set in the 'group' route property.

'group' property also accepts an array of group ids, to assign properties from multiple groups.

Redirect routes

QueryRoute is just one of the routes shipped with Cortex. There are others and it is possible to write custom routes implementing Brain\Cortex\Route\RouteInterface.

Another implementation included in Cortex is RedirectRoute. As the name suggests, it is used to redirect urls to other urls.

RedirectRoute accepts an array of options as well.

Using option is possible to configure HTTP status code to use ('redirect_status' option, default 302) and if allows or not redirect to external urls ('redirect_external' option, default false).


Installation

Via Composer, require brain/cortex in version ~1.0.0.

composer require brain/cortex:~1.0.0

You may need to lessen your project's minimum stability requirements.

composer config minimum-stability dev

Minimum Requirements

Dependencies

License

MIT


All versions of cortex with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
nikic/fast-route Version ~0.7.0
psr/http-message Version <1.1
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 brain/cortex contains the following files

Loading the files please wait ....