2017 © Pedro Peláez
 

library fp-web

test bed for a functional web toolkit

image

slogsdon/fp-web

test bed for a functional web toolkit

  • Tuesday, July 7, 2015
  • by slogsdon
  • Repository
  • 1 Watchers
  • 1 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

fp-web

Packagist Version Build Status Coverage Status, (*1)

Test bed for a functional web toolkit, (*2)

This is just an experiment for what a web toolkit that doesn't use object-oriented code., (*3)

In theory, this is just a bit of PHP and should be fine for use, but in practice, don't use this but use something more established, more tested, and more used instead., (*4)

Running the example

$ git clone https://github.com/slogsdon/php-fp-web
$ cd php-fp-web
$ composer install
$ php -S 0.0.0.0:8888 -t example

In another terminal session:, (*5)

$ curl -i http://localhost:8800/index
HTTP/1.1 200 OK
Host: localhost:8888
Connection: close
X-Powered-By: PHP/5.6.10
Content-type: text/html; charset=UTF-8

index
$ curl -i http://localhost:8800/
HTTP/1.1 404 Not Found
Host: localhost:8888
Connection: close
X-Powered-By: PHP/5.6.10
Content-type: text/html; charset=UTF-8

Not Found

Usage

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

use \FPWeb\App;
use \FPWeb\Route;

// index handler
$index = function ($conn) {
    // TODO: make this process nicer
    $conn['response']['body'] = 'index';
    return $conn;
};

// create routes
$routes = [
    Route\get('/index', $index),
];

// match request and run match
$response = App\run($routes, [
    'param_set' => [$_GET, $_POST],
    'on_error' => function ($conn) {
        $conn['response']['body'] = 'Not Found';
        return $conn;
    },
]);

printf('

%s
', print_r($response, true));

The Versions

07/07 2015

dev-master

9999999-dev

test bed for a functional web toolkit

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

07/07 2015

0.0.8

0.0.8.0

test bed for a functional web toolkit

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

07/07 2015

0.0.7

0.0.7.0

test bed for a functional web toolkit

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

07/07 2015

0.0.6

0.0.6.0

test bed for a functional web toolkit

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

06/07 2015

0.0.5

0.0.5.0

test bed for a functional web toolkit

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires