hub20xx/php-local-server
Composer 安装命令:
composer require --dev hub20xx/php-local-server
包简介
A class to manage PHP's built-in server
README 文档
README
You're on linux and you want a simple way to start and stop a local server.
Install
Via Composer
$ composer require hub20xxx/php-local-server
Usage
require __DIR__ . '/vendor/autoload.php'; $docroot = __DIR__ . '/www'; // by default the server is running on 127.0.0.1:1111 $server = new PhpLocalServer\Server($docroot); // you can specify the address and port // in the constructor $address = '127.0.0.2'; $port = '1234'; $server = new Server($docroot, $address, $port); // or using the setters $server = new Server($docroot); $server->setAddress($address); $server->setPort($port); // setting environment variables $server->setEnvironmentVariable('ENV', 'testing'); $server->setEnvironmentVariable('FOO', 'bar'); // starting the server $server->start(); // using the server // stopping the server $server->stop(); // $server->stop() is called in the destructor in case you omit to stop the server
Testing
$ phpunit
License
Credits / Thanks
This package was inpired by this blog post
Many thanks :)
Contributing
If you'd like to contribute, please use Github (issues, pull requests etc).
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-13