shroophp/restful

使用 ShrooPHP 构建 RESTful 应用的库。

v1.0.5 2019-11-07 00:41 UTC

This package is not auto-updated.

Last update: 2024-09-29 10:04:42 UTC


README

用于构建 RESTful 应用的 PHP 库。

安装

composer require 'shroophp/restful ^1.0'

示例用法

<?php

use ShrooPHP\Framework\Application;
use ShrooPHP\RESTful\Collections\HashTable;
use ShrooPHP\RESTful\Resources\Immutable;
use ShrooPHP\RESTful\Request\Handler;

require 'vendor/autoload.php';

$collection = new HashTable;
$handler = new Handler($collection);
$resource = new Immutable('Hello, world!', 'text/plain');

$collection->put('/', $resource);

(new Application)->push($handler)->run();