Download the PHP package bafs/via without Composer

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

Via

PHP 5.3+ version license

Via is a simple and scalable router inspired by express.

This is the very first version, use with caution !

Needed

Installation with composer


Using Via

Complete Hello World example

Simple route

With parameters

Multiple methods

Match multiple routes

Using namespaces

Use basic Via engine

Advanced usage

Using function will call $next() automatically

With specific method

Handle a controller

With regular expression


Documentation

Router (app)

get(string $route, function $callback)

Add a route with GET verb

post(string $route, function $callback)

Add a route with POST verb

put(string $route, function $callback)

Add a route with PUT verb

delete(string $route, function $callback)

Add a route with DELETE verb

on(string|array $verb, string $route, function $callback)

Add a route (can use muliple verb)

all(function $callback)

Add a route that always match

using(function $callback)

Add a route that always match and go to next

with(string $namespace, function $callback)

Add a namespace (prefix all routes)

get(string $name)

Get value from container

set(string $name, mixed $value)

Set value in app container

render(string $view, array $data)

Render a view

Request

Fields

get(string $field)

Get a specific header

param(string $name)

Return if exists (in order) $req->params->$name, $req->body->$name or $req->query->$name

is(string $type)

Check if mime type is in header

[static] getRelativeURIToRoot()

Return path relative to root (eg. useful for assets in views)

[static] isRewriteActive()

Check if rewrite engine is active (rewrite can be enable but no active !)

Response

send([int $status], string $message)

Send output buffer

json([int $status], string $json)

Send output buffer and force json content-type

ssend([int $status], string $message)

Same as send but encode special html chars

redirect([int $status], string $url)

Redirect client to specific url

download(string $path, [string $filename, string $contentType])

Force to download a specific file

file($filename, [$content])

Read or write file

contentType(string $type)

set(string $field, string $value)

Set header parameters

status(int $code)

cookie(string $name, [string $value, array $options])

clearCookie(string $name, [array $options])

render(string $view, array $data)

Alias of render in "Router"

Dev

To run the tests, go to the test folder, edit URL constant (run.php line 10) and run php run.php.


All versions of via with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.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 bafs/via contains the following files

Loading the files please wait ....