2017-25 © Pedro Peláez
 

library ypf

PHP framework & Application Server.

image

millken/ypf

PHP framework & Application Server.

  • Monday, July 30, 2018
  • by millken
  • Repository
  • 2 Watchers
  • 3 Stars
  • 175 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 10 Versions
  • 13 % Grown

The README.md

ypf framework

Overview

A micro php7 framework. in swoole mode, 10x performance can be improved., (*1)

The framework is mainly for the use of senior PHP programmers, keep everything under control., (*2)

Supports and uses various PSRs:, (*3)

  • PSR-2 (Coding Standard)
  • PSR-4 (Autoloading)
  • PSR-7 (HTTP Message)
  • PSR-11 (Container Interface)
  • PSR-15 (HTTP Middleware)

Installion

composer require millken/ypf

Requirements

  1. PHP 7.2+
  2. Swoole 4.2+ (Optional but recommended)

Usage

php swoole.php, (*4)

//swoole.php

require './vendor/autoload.php';
use GuzzleHttp\Psr7\Response;

$router = new Ypf\Route\Router();
$router->map('GET', '/', function ($request) {
    return 'test';
});
$router->map('GET', '/hello/{name}?', function ($request) {
    $name = ucwords($request->getAttribute('name', 'World!'));

    return new Response(200, [], 'hello '.$name);
});

$services = [
    'factory' => Ypf\Application\Swoole::class,

    'swoole' => [
        'server' => [
            'address' => '127.0.0.1',
            'port' => 7000,
        ],
        'options' => [
            'dispatch_mode' => 1,
        ],
    ],
    'middleware' => [
        new Ypf\Route\Middleware($router),
    ],
];

$app = new Ypf\Application($services);

$app->run();

swoole performance, (*5)

 wrk -t 20 -c 200 -d 30s "http://127.0.0.1:7000/"
Running 30s test @ http://127.0.0.1:7000/
  20 threads and 200 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     2.16ms    1.94ms  40.97ms   88.56%
    Req/Sec     5.50k   521.94    19.49k    86.64%
  3289431 requests in 30.10s, 501.93MB read
Requests/sec: 109285.69
Transfer/sec:     16.68MB

php -S 127.0.0.1:7000 cgi.php #cgi mode, (*6)

//cgi.php

require './vendor/autoload.php';
use GuzzleHttp\Psr7\Response;

$router = new Ypf\Route\Router();
$router->map('GET', '/', function ($request) {
    return 'test';
});
$router->map('GET', '/hello/{name}?', function ($request) {
    $name = ucwords($request->getAttribute('name', 'World!'));

    return new Response(200, [], 'hello '.$name);
});

$services = [
    'middleware' => [
        new Ypf\Route\Middleware($router),
    ],
];

$app = new Ypf\Application($services);

$app->run();

See the full example, (*7)

License

Apache License, Version 2.0, (*8)

The Versions

02/07 2018

dev-master

9999999-dev https://github.com/millken/ypf/

PHP framework & Application Server.

  Sources   Download

Apache-2.0 LGPL

The Requires

 

by Avatar millken

framework library webserver

24/10 2017

1.2.1

1.2.1.0 https://github.com/millken/ypf/

PHP framework & Application Server.

  Sources   Download

LGPL

The Requires

 

by Avatar millken

framework library webserver

04/07 2017

1.2.0

1.2.0.0 https://github.com/millken/ypf/

PHP framework & Application Server.

  Sources   Download

LGPL

The Requires

 

by Avatar millken

framework library webserver

04/07 2017

dev-dev

dev-dev https://github.com/millken/ypf/

PHP framework & Application Server.

  Sources   Download

LGPL

The Requires

 

by Avatar millken

framework library webserver

22/09 2016

1.0.4

1.0.4.0 https://github.com/millken/ypf/

PHP framework & Application Server.

  Sources   Download

LGPL

The Requires

 

by Avatar millken

framework library webserver

18/08 2016

1.0.3

1.0.3.0 https://github.com/millken/ypf/

PHP framework & Application Server.

  Sources   Download

LGPL

The Requires

 

by Avatar millken

framework library webserver

28/07 2016

1.0.2

1.0.2.0 https://github.com/millken/ypf/

PHP framework & Application Server.

  Sources   Download

LGPL

The Requires

 

by Avatar millken

framework library webserver

28/07 2016

1.0.1

1.0.1.0 https://github.com/millken/ypf/

PHP framework & Application Server.

  Sources   Download

LGPL

The Requires

 

by Avatar millken

framework library webserver

14/04 2016

1.0.0

1.0.0.0 https://github.com/millken/ypf/

PHP framework & Application Server.

  Sources   Download

LGPL

The Requires

 

by Avatar millken

framework library webserver