rubyqorn/lightweight-router

This is a PHP library which simplify interaction with route system in your web application

v1.1 2019-07-16 14:33 UTC

This package is auto-updated.

Last update: 2024-05-04 22:49:57 UTC


README

This is a simple and lightweight library which give you simple representetion about routing system.

Installation

If you want to use this libary for your web application. You have to install composer and use composer init for initialize composer.json file. And then you can insert in require block rubyqorn/lightweight-router and in CLI use composer install or just prescribe

```php composer require rubyqorn/lightweight-router ```

Where register and look at my routes?

In the src/config/routes.php you can register your routes which will be use in your web application. If you don't want to register your routes in this file you can require autoload file in index.php

```php require 'vendor/autoload.php '; ```

and access route class

```php use Lightweight\Http\Route; ```

How to use?

You have four router types:

  • GET
  • POST
  • PUT
  • DELETE

Example:

```php Route::get('home', 'ExampleController@example'); ```

If you want to use params in your routes. You can use

  • {slug}
  • {id}

Just like this

```php Route::post('article/{id}', 'ExampleController@example'); ``` ```php Route::delete('article/{slug}', 'ExampleController@example'); ```