Download the PHP package webx/routes without Composer

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

WebX-Routes - A PHP controller framework

Main features and design goals of webx-routes:

Getting started

In composer.json add:

Writing your first Routes index.php public/index.php

Will generate JSON response:

Built-in ResponseTypes in Routes

Routes supports the following ResponseTypes out of the box

Routing in Routes

Routing in Routes - with url parameters example

Will render:

Route switches:

Route switches are evaluated top-down. If a route-switch is executed no further switches, in same the scope, are evaluated and executed.

The following route switches are supported

Using Twig

page.twig

Reading input

Routes provides a unified and type-safe way to read request input from query parameters and json- form-encoded requests.

Configuring Twig

Load a configuration changetwig (can be any name) at Bootstrap time.

Example: To change Twigs tag-delimeters to {{{ and }}} (To simplify mixed Angular and Twig in the same page).

Override the setting for TemplateResponseType to add a configurator for Twig config/changetwig.php:

Loading configurations and the IOC container

All logic, in Routes, is executed in . An action can be either a:

To support lazy loading of configurations Routes allows actions to be defined as an array in the format: [$action,"config1","config2","configN"]

src/MyBusiness/Impl/Services/AdminService.php

config/admin.php:

Config file anatomy

The config files, that may be loaded at any level, are normal php files that are expected to return an array.

Minimal config file (that does nothing):

Ioc container

The WebX-Ioc container is embedded in the WebX-Routes framework. WebX-Routes supports dynamic registration / static invokation of services in the config ioc section.

Dynamically register a service with the WebX-Ioc container. config/someconfig.php

Working with Controllers

Routes support a more traditional controller structure as well. Controllers are simple classes with their methods and constructors invoked with IOC support.

Routes supports $action to be defined as a string in the format ControllerClass#method

src/MyBusiness/Controllers/AdminController.php

Defining default namespaces for loading controllers

Full class names can be skipped by adding namespaces in the namespaces section of a dynamic configuration.

config/admin.php:

Creating your own ResponseType

To implement your own ResponseType simply create an interface that extends ResponseType with an implementation configure it with ioc/register in a config file. See bootstrap_config.php of how to configure.

Configuring your own ResponseType in your config file:

Configuring Routes

Standard configuration in Routes is based on the applications directory relativly to the $_SERVER['DOCUMENT_ROOT'].

Configuring RoutesBootstrap

The default directory structure for a Routes application:

Tests

Execute in root directory


All versions of routes with dependencies

PHP Build Version
Package Version
Requires webx/ioc Version 2.0.0
defuse/php-encryption Version ^2.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 webx/routes contains the following files

Loading the files please wait ....