1. Go to this page and download the library: Download tigerb/easy-php 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/ */
// config/moduleName/route.php, this 'this' point to RouterHandle instance
$this->get('v1/user/info', function (Framework\App $app) {
return 'Hello Get Router';
});
class Demo
{
public function __construct ()
{
// the demo directly dependent on RelyClassName
$instance = new RelyClassName ();
}
}
// env config
[log]
path = /runtime/logs/
name = easy-php
size = 512
level= debug
// How to use in your logic
Log::debug('EASY PHP');
Log::notice('EASY PHP');
Log::warning('EASY PHP');
Log::error('EASY PHP');
cd public && php server.php
namespace Jobs\Demo;
/**
* Demo Jobs
*
* @author TIERGB <https://github.com/TIGERB>
*/
class Demo
{
/**
* job
*
* @example php cli --jobs=demo.demo.test
*/
public function test()
{
echo 'Hello Easy PHP Jobs';
}
}
php cli --job=demo.demo.test
/**
* test assertion example
*/
public function testDemo()
{
$this->assertEquals(
'Hello Easy PHP',
// assert the result by run hello function in demo/Index controller
App::$app->get('demo/index/hello')
);
}
runtime/build/App.20170505085503.phar
// );
cd bin && php cli --run
php cli --method=<module.controller.action> --<arguments>=<value> ...
For example, php cli --method=demo.index.get --username=easy-php
cd public && php server.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.