2017 © Pedro Peláez
 

library expressphp

Biblioteca para roteamento (Similar a ExpressJS)

image

carlosroberto555/expressphp

Biblioteca para roteamento (Similar a ExpressJS)

  • Monday, May 7, 2018
  • by CARLOSROBERTO555
  • Repository
  • 1 Watchers
  • 0 Stars
  • 25 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 4 % Grown

The README.md

ExpressPHP

A express like lib for PHP language, (*1)

Installation

You need first to have composer previous installed. You can see more on https://getcomposer.org., (*2)

Now you install this package using:, (*3)

$ composer require carlosroberto555/expressphp

Quick Start

Basic use;, (*4)

<?php
include 'vendor/autoload.php';

$app = new ExpressPHP\Express;

$app->use('/', function ($req, $res) {
  $res->send('Hello world!');
});

Include a children app scope

The new app that includes a children route. The Express app has a static method require, to include a php executable file with actual route scope., (*5)

<?php
include 'vendor/autoload.php';

$app = new ExpressPHP\Express;

$app->use('/api', app::require('/routes/api.php'));

Children route:, (*6)

<?php
// file /routes/api.php
$router = ExpressPHP\Express::Router();

// GET /api/users
$router->get('/users', function ($req, $res) {
  $res->json([
    ['name' => 'Libbie Dunn'],
    ['name' => 'Ella-Mai Davies'],
    ['name' => 'Elsie-Rose Dennis'],
    ['name' => 'Zena Slater'],
    ['name' => 'Antoni Partridge'],
  ]);
});

Include a static content children route

Express has a method called static to include static content. This just send files like images, html, css, js with a cache control header I-Modiffied-Since., (*7)

<?php
include 'vendor/autoload.php';

use ExpressPHP\Express as app;

$app = new app;

$app->use('/hello', app::static('/static/index.html'));
// $app->use('/css', app::static('/static/css'));
// $app->use('/uploads', app::static('/static/images/uploads'));

The html example file:, (*8)

<!DOCTYPE html>
<!-- /static/index.html -->
<html>
  <head>
    <meta charset="utf-8" />
  </head>
  <body>
    <h1>Hello world</h1>
  </body>
</html>

The Versions

07/05 2018

dev-master

9999999-dev

Biblioteca para roteamento (Similar a ExpressJS)

  Sources   Download

MIT

The Requires

 

by Carlos Roberto

22/03 2018

dev-User-class

dev-User-class

Biblioteca para roteamento (Similar a ExpressJS)

  Sources   Download

MIT

The Requires

 

by Carlos Roberto

21/02 2018

v1.0.0-alpha.4

1.0.0.0-alpha4

Biblioteca para roteamento (Similar a ExpressJS)

  Sources   Download

MIT

The Requires

 

by Carlos Roberto

16/02 2018

v1.0.0-alpha.3

1.0.0.0-alpha3

Biblioteca para roteamento (Similar a ExpressJS)

  Sources   Download

MIT

The Requires

 

by Carlos Roberto

13/02 2018

v1.0.0-alpha.2

1.0.0.0-alpha2

Biblioteca para roteamento (Similar a ExpressJS)

  Sources   Download

MIT

by Carlos Roberto

09/02 2018

v1.0.0-alpha.1

1.0.0.0-alpha1

Biblioteca para roteamento (Similar a ExpressJS)

  Sources   Download

MIT

by Carlos Roberto