1. Go to this page and download the library: Download beanmoss/annotroute 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/ */
use Beanmoss\Annotroute\Annotation\Route as MyRoute;
/**
* @MyRoute(group={"prefix" = "home", "before" = "auth"})
*/
class HomeController extends BaseController
{
/*
|--------------------------------------------------------------------------
| Default Home Controller
|--------------------------------------------------------------------------
|
| You may wish to use controllers instead of, or in addition to, Closure
| based routes. That's great! Here is an example controller method to
| get you started. To route to this controller, just add the route:
|
| Route::get('/', 'HomeController@showWelcome');
|
*/
/**
* @MyRoute(method="get", path="/")
* @MyRoute(method="get", path="/welcome")
*/
public function showWelcome()
{
return View::make('hello');
}
/**
* @MyRoute(
* method="get",
* path="/test/{id}/{name}",
* before = "",
* name="test",
* where={"id" = "[0-9]+","name" = "[a-z]+"}
* )
*/
public function test($id, $name)
{
return 'test' . $id . $name;
}
}
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
AnnotRoute::generateRoute('HomeController');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.