2017 © Pedro Peláez
 

library patika

Simple PHP routing library.

image

ozziest/patika

Simple PHP routing library.

  • Sunday, January 3, 2016
  • by ozziest
  • Repository
  • 1 Watchers
  • 7 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Patika

Build Status Total Downloads Latest Stable Version Latest Unstable Version License, (*1)

Patika is a simple routing package that you can use easily your projects. This is small and useful package because you dont have to define all routes. You should code your controller instead of routing defination., (*2)

Installation

To install through composer, simply put the following in your composer.json file:, (*3)

{
    "require": {
        "ozziest/patika": "dev-master"
    }
}
$ composer update

Usage

First of all, you should define .htaccess file so that handle all request and send it to index.php file., (*4)

.htaccess, (*5)

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

index.php file must be defined like this;, (*6)

// Including composer autoload file
include 'vendor/autoload.php';

// First of all, you should use try-catch block for handling routing errors
try {
    // You must create a new instance of Manager Class with the app argument.
    $patika = new Ozziest\Patika\Manager(['app' => 'App\Controllers']);
    // And calling the route!
    $patika->call();
} catch (Ozziest\Patika\Exceptions\PatikaException $e) {
    // If the controller or method aren't found, you can handle the error.
    echo $e->getMessage();
}

That's all! Patika Router is active now. Now, you can define your controller which what you want., (*7)

Users.php, (*8)

namespace App\Controllers;

class Users {

    /**
     * All
     *
     * @return null
     */
    public function all()
    {
        echo 'App\Controllers\Users@all()';
    }

}

Checking

$ php -S localhost:8000 index.php
$ curl -X GET localhost:8000/users/all 

Full Documentation

You can read the Full Documentation!, (*9)

The Versions

03/01 2016

dev-master

9999999-dev https://github.com/ozziest/patika

Simple PHP routing library.

  Sources   Download

MIT

The Development Requires

by Özgür Adem Işıklı

php routing router

31/12 2015

1.1.1

1.1.1.0 https://github.com/ozziest/patika

Simple PHP routing library.

  Sources   Download

MIT

The Development Requires

by Özgür Adem Işıklı

php routing router

16/09 2015

1.0.0

1.0.0.0 https://github.com/ozziest/patika

Simple PHP routing library.

  Sources   Download

MIT

The Development Requires

by Özgür Adem Işıklı

php routing router

13/09 2015

dev-dev

dev-dev https://github.com/ozziest/patika

Simple PHP routing library.

  Sources   Download

MIT

The Development Requires

by Özgür Adem Işıklı

php routing router