1. Go to this page and download the library: Download salodev/modularize 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/ */
salodev / modularize example snippets
namespace App\Modules;
use Salodev\Modularize\Module;
class AppModule extends Module {
}
public function register() {
$this->provide(ChildModule::class);
}
class UsersModule {
public function bootApiRoutes() {
$this->router()->get('', [UsersController::class, 'index']);
// For api authorized requests
$this->router()->middleware('auth:api')->group(function() {
$this->router()->get('/me', [UsersController::class, 'me']);
});
}
}
$this->routePrefix = 'my-route-prefix'
// another case
$this->routePrefix = '{account}' // for GET user/{account}