PHP code example of protibimbok / laramod

1. Go to this page and download the library: Download protibimbok/laramod 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/ */

    

protibimbok / laramod example snippets


class BlogModule implements Module, ProvidesRoutes, ProvidesMigrations
{
    public function name(): string
    {
        return 'blog';
    }

    public function path(): string
    {
        return __DIR__;
    }

    public function routes(Router $router): void
    {
        

use Modules\Blog\BlogModule;

return [
    BlogModule::class,
];

use Laramod\Facades\Modules;

Modules::register([BlogModule::class]);

view('blog::posts.index');
__('blog::messages.title');

public function config(): array
{
    return ['modules.blog' => 'config/blog.php'];
}

config('modules.blog.per_page');

use Laramod\Facades\Seeder;

public function run(): void
{
    Seeder::runSeeders();
}

public function viteEntries(): array
{
    return ['resources/js/app.js'];
}
bash
composer laramod:init
bash
php artisan make:module Blog

Modules/Blog/
├── BlogModule.php
├── ai-workflow/README.md
├── Http/Controllers/BlogController.php
├── Http/Controllers/Api/BlogController.php
├── Database/Migrations/
├── Tests/Feature/BlogModuleTest.php
├── config/blog.php
├── lang/en/messages.php
└── routes/{web,api}.php
bash
php artisan make:model Post -mfs --module=Blog
php artisan make:controller PostController --module=Blog
php artisan make:test PostTest --module=Blog