1. Go to this page and download the library: Download shrikeh/teapot library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
shrikeh / teapot example snippets
/**
* @dataProvider someUrlProvider
*/
public function testResponseIsOK($url)
{
$client = new Client($url);
$response = $client->get();
$this->assertSame(200, $response->getStatusCode());
}
use Teapot\StatusCode;
...
$this->assertSame(StatusCode::OK, $response->getStatusCode());
use Teapot\StatusCode;
class FooController implements StatusCode
{
public function badAction()
{
if ($this->request->getMethod() == 'POST') {
throw new \Exception('Bad!', self::METHOD_NOT_ALLOWED);
}
}
}
use Teapot\HttpException;
use Teapot\StatusCode;
throw new HttpException(
'Sorry this page does not exist!',
StatusCode::NOT_FOUND
);
use Teapot\HttpException;
throw new HttpException(
'Sorry this page does not exist!',
HttpException::NOT_FOUND
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.