1. Go to this page and download the library: Download overtrue/yaf-skeleton 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/ */
overtrue / yaf-skeleton example snippets
class ExampleController extends BaseController
{
public function handle()
{
return 'Hello world!';
// return json(['foo' => 'bar']);
// return redirect('https://easywechat.com');
// return view('welcome', ['name' => 'MyApp']); // template engine
public function handle()
{
$data = [
'name' => 'overtrue',
'age' => 28,
];
return view('profile-page', $data);
}
$controller = mock_controller(Foo_BarController::class);
// Indicates the method to mock, and the protected method is also mockable
$controller = mock_controller(Foo_BarController::class, ['getUsers', 'getApp']);