Generates and handles Modules for Laravel

Overview

L5Modular logo

L5Modular

Keep Your Laravel App Organized


latest release build maintainability code coverage downloads All Contributors license


This package allows you to organize your Laravel project in a modular manner.
You can simply drop or generate modules with their own controllers, models, views, routes, etc. into the app/Modules folder and go on working with them.


Documentation

Check out the full documentation at l5modular.com


Installation

The easiest way to install this package is through your terminal via Composer.
Run the following command in a bash prompt from your projects root

composer require artem-schander/l5-modular

Requirements

L5Modular v2 requires at least PHP 7.2 and Laravel 5.7
Older PHP / Laravel versions are supported by L5Modular v1.




Contributors

Thanks goes to these wonderful people:


Julio Motol

πŸ’» ⚠️ πŸ”§

Hussein Feras

πŸ’» ⚠️ πŸ”§

Farhan Wazir

πŸ’»

David HΓΆck

πŸ’»

Kis Viktor

πŸ’»

Akram Berkawy

πŸ’»

Thomas Eriksson

πŸ›

Also thanks to zyhn for the "Modular Structure in Laravel 5" tutorial. Well explained and helped a lot.




Contact

Feel free to join the Slack chat.




License

L5Modular is licensed under the terms of the MIT License (See LICENSE file for details).

Comments
  • Extend Laravel's scaffolding commands to generate in a certain module

    Extend Laravel's scaffolding commands to generate in a certain module

    Hi, thank you for providing this awesome package. Our team have been using this for years now. As good as it is, it can be troublesome to generate controllers,models, etc. using Laravel's scaffolding commands. It would be nice if we could just run php artisan make:controller SomeController --module=SomeModule and the generated controller will be inside the assigned module.

    I have forked this repo and tried implementing this, you can see the branch here. I've only applied what I think is sensible to be placed in their respective module (e,g, events, jobs, listeners, etc.). I can exclude or include others if you so desire, just let me know.

    I've done some light testing on it but I'd like to know how you properly test this so I could too before I make a PR for this.

    enhancement question 
    opened by juliomotol 25
  • Route cache not working

    Route cache not working

    When using this module I noticed that route caching don't work on the routes.php files in the different modules.

    I would suggest this solution in the ModuelServiceProvider file:

    // Allow routes to be cached
    if(is_dir(app_path().'/Modules/')) {
    $modules = config("modules.enable") ?: array_map('class_basename', $this->files->directories(app_path().'/Modules/'));
    foreach($modules as $module)  {
    // Allow routes to be cached
    if (!$this->app->routesAreCached()) {
        $routes = app_path() . '/Modules/' . $module . '/routes.php';
        if($this->files->exists($routes)) include $routes;
    }
    $helper = app_path().'/Modules/'.$module.'/helper.php';
    $views  = app_path().'/Modules/'.$module.'/Views';
    $trans  = app_path().'/Modules/'.$module.'/Translations';
    
    if($this->files->exists($helper)) include $helper;
    if($this->files->isDirectory($views)) $this->loadViewsFrom($views, $module);
    if($this->files->isDirectory($trans)) $this->loadTranslationsFrom($trans, $module);
    }
    }
    
    enhancement 
    opened by tombombadilll 15
  • model not working

    model not working

    I write on model and contlloer it is now wokring

            $filght = Blogs::all();
        print_r($filght);
    

    "Model"

    opened by NileshBadgi-Idealtechnologys 8
  • Module Route with middleware auth not works

    Module Route with middleware auth not works

    Hello, first of all thank you for your works!

    I'm using your module, but i think to have find a problem. Default routes of module (web.php) is:

    Route::group(array('module' => 'Test', 'middleware' => ['web'], 'namespace' => 'App\Modules\Test\Controllers'), function() {
     //list of my routes, for example 
     Route::get('/test', 'TestController@testIndex');
    });
    

    If i would like to protect my routes by middleware, i should change Route::group like that:

    Route::group(array('module' => 'Test', 'middleware' => ['**auth**'], 'namespace' => 'App\Modules\Test\Controllers'), function() {
     //list of my routes, for example
     Route::get('/test', 'TestController@testIndex');
    });
    
    

    If i change Route::group like example above when i try to go to "/test", i will be redirect to "/". My suspicion is that auth middleware are not loaded in right way inside module, maybe for different namespace?

    The only way i finded to workaround, is to edit routes.php of project (not of module!) adding inside Route::group(['middleware' => ['auth']], function() { [...] Route::get('/test', '\App\Modules\Test\Controllers\TestController@testIndex');[...]

    This is no a really useful way to solve the problem. What i can do to solve that problem in web.php of module, istead of edit main Route file?

    Best Regards, Simone

    opened by ghost 6
  • artisan route:cache fails

    artisan route:cache fails

    artisan route:cache command fails due to more than one inclusion of the helper.php files.

    I have fixed the issue with updating "include $helper;" to "include_once $helper;" in boot() method of ModuleServiceProvider class.

    opened by mtutumlu 5
  • Not working with Laravel < v5.1.1

    Not working with Laravel < v5.1.1

    I have been using this package for about an year now and am very pleased with how easily it manages modules in a project.

    But, I am still using my project with Laravel 5.1.1 and recently noticed (when doing some composer updates) that it was throwing the following error. http://imgur.com/iAUlGSC

    So, is there anyway I can get over this issue or it no longer supports Laravel less than v5.1.1?

    Any help is much appreciated.

    Thanks in advance.

    opened by bkkrishna 5
  • Error when using action()

    Error when using action()

    Hello.

    I've updated L5 Modular in my project from V1 to V2.

    I've set the config file to load the V1 modules, but now I'm getting this message:

    Target class [App\Modules\MyModule\Controllers\App\Modules\MyModule\Controllers\MyController] does not exist.

    I think that this is happening because some of the project developers have used the action function with the full path to the controller method [Ex: action('\App\Modules\MyModule\Controllers\MyController@index');] and L5 Modular makes the concatenation beetween the module path and with the action parameter.

    Can someone help me with this?

    Thank's!

    bug 
    opened by lparede 3
  • config files for a specific module

    config files for a specific module

    Is your feature request related to a problem? Please describe. many of the time a module need a configuration that can be published to the main project this feature in so important to the modules structures and make it easy to reuse the module in other projects with different configurations

    Describe the solution you'd like It would be awesome if I can add a config file for my module for example: app/Modules/FooBar/config/config.php

    Describe alternatives you've considered and if you add an artisan command like (php artisan make:module:config) that would be awesome too

    Additional context

    enhancement 
    opened by husseinferas 3
  • studly_case() undefined

    studly_case() undefined

    Call to undefined function ArtemSchander\L5Modular\Console\studly_case()

    hi, I always get this error when making a module, I tried to remove the studly_case and other function indicated on the error, and it works, I hope you'll fix this for laravel 6.*

    bug 
    opened by tristanantazo 3
  • Laravel 5.5 issue when hitting make:module ModuleName error was occured

    Laravel 5.5 issue when hitting make:module ModuleName error was occured

    Hi,

    I would like to report this issue when I tried to run the command on generating module error was occurred. Please check below.

    https://www.screencast.com/t/lRosinIVIJ6

    Note: My php version: 7.1+

    Thank you.

    Ronard

    opened by ghost 3
  • Route problem

    Route problem

    Hi there,

    Could you please help me out with a problem with this package. Actually the problem is that when I try to protect my routes with auth middleware in the web.php file, then the auth middleware doesn't work, but however if I use the middleware in the api.php file then the routes in the web.php is also protected.

    It seems that the package is prioritizing api.php file before web.php file. I hope I have made the situation clear.

    Thanks

    opened by DezrtRose 3
  • Modules namespaces and routes

    Modules namespaces and routes

    How to use namespace Admin/Module_name and User/Module_name ?

    folder routes not auto use ... :-(

    image

    Admin/routes/web.php Work (Module auto use only this path)

    Admin/Test/routes/web.php Not Work

    bug 
    opened by ZeoNish 5
  • Class L5Modular not found

    Class L5Modular not found

    Describe the bug Installed this package on clean laravel 8.12 and jsut make a new module call Faq.

    After this I just go to https://l5modular.com/usage/#facade

    and using first one

    L5Modular::exists('HelloWorld');

    and it give me following error

    Error Class 'L5Modular' not found http://localhost:8000/test/

    To Reproduce Steps to reproduce the behavior:

    1. Install new laravel and this package.
    2. Make any module after setup the package.
    3. Make a test route and use any facade from docs or the exists() one.
    4. You will get class not found error.

    Expected behavior It should return true or false as per docs.

    Screenshots

    image

    Environment (please complete the following information):

    • OS & version: Windows 10 Build 19042
    • Laravel version: 8.12
    • L5Modular version: 2.1
    bug 
    opened by thegr8dev 9
  • Livewire support

    Livewire support

    Hello, guys.

    It would be great if we could have Livewire support in this package, so we could create Livewire components and views inside each module.

    Is it possible?

    Thank you.

    enhancement 
    opened by lparede 4
  • Migrations in the old way

    Migrations in the old way

    Hey guys

    How can I generate migrations in the standard way like in the previous versions ? I've played around with config files but no way

    UPDATE :

    I had to edit this method here in MigrateMakeCommand Class

     protected function getMigrationPath()
        {
           
            $migrationPath = $this->laravel['path'] .'/' . $this->getConfiguredFolder('migrations');
       
            if (! is_null($targetPath = $this->input->getOption('path'))) {
                return $migrationPath . '/' . $targetPath;
            }
    
            return $migrationPath;
        }
    

    is there a cleaner way to make this change ?

    enhancement question 
    opened by atefrihane 5
  • Add functional arrilot/laravel-widgets

    Add functional arrilot/laravel-widgets

    I liked the arrilot/laravel-widgets functionality. Roughly add widgets through the module:

    class ModuleServiceProvider

    use Illuminate\Support\Facades\View;

    function boot()

    $widgets  = app_path().'/Modules/'.$module.'/Widgets';
    
    if ($this->files->isDirectory($widgets)){
    	$directories = $this->files->directories($widgets);
    	foreach($directories as $Widjet){ 
    		$WidjetViews = $Widjet."/Views";
    		if ($this->files->isDirectory($WidjetViews)) {
    			View::addNamespace('Module.'.$module.'.Widget', $WidjetViews);
    		}
    		$controllerList = $this->files->files($Widjet);
    		foreach($controllerList as $controller){
    			include_once($controller->getPathname());
    		}
    	}
    } 
    

    laravel-project/
        app/
        └── Modules/
            └── FooBar/
                └── Widgets/
                    └── Widget/
                         └── Views/
                              └── bar.blade.php
                         Bar.php
    

    view('Module.FooBar.Widget::bar')

    enhancement 
    opened by garbuzivan 4
Releases(2.1.1)
Owner
Artem Schander
Artem Schander
This package provides an integration with FFmpeg for Laravel. Laravel's Filesystem handles the storage of the files.

Laravel FFMpeg This package provides an integration with FFmpeg for Laravel 6.0 and higher. Laravel's Filesystem handles the storage of the files. Lau

Protone Media 1.3k Jan 1, 2023
Generates and configures facades for laravel

Laravel Facade This package makes the process of creating facades in laravel super easy and with one simple artisan command. For each facade created w

Haytham Mones 10 Aug 31, 2022
Searches for multilingual phrases in Laravel project and automatically generates language files for you.

Laravel Lang Generator Searches for multilingual phrases in a Laravel project and automatically generates language files for you. You can search for n

Gleb 5 Oct 19, 2022
⚑ PowerGrid generates Advanced Datatables using Laravel Livewire.

?? Documentation | ?? Features | ⌨️ Get started Livewire ⚑ PowerGrid ⚑ PowerGrid creates modern, powerful and easy to customize Datatables based on La

Power Components ⚑ 962 Jan 2, 2023
A package to generate modules for a Laravel project.

Laravel Modular A package to generate modules for a Laravel project. Requirements PHP 7.4 or greater Laravel version 8 Installation Install using comp

DPTSI 5 Mar 16, 2022
List of 77 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.

Laravel Lang In this repository, you can find the lang files for the Laravel Framework 4/5/6/7/8, Laravel Jetstream , Laravel Fortify, Laravel Cashier

Laravel Lang 6.9k Jan 2, 2023
A Laravel 8 and Livewire 2 demo showing how to search and filter by tags, showing article and video counts for each tag (Polymorphic relationship)

Advanced search and filter with Laravel and Livewire A demo app using Laravel 8 and Livewire 2 showing how to implement a list of articles and tags, v

SΓ©rgio Jardim 19 Aug 29, 2022
Laravel Podcast is Laravel 5.5 web app that enables you to manage RSS feeds for your favorite podcasts and listen to the episodes in a seamless UI and User Authentication.

Laravel Podcast is Laravel 5.5 web app that enables you to manage RSS feeds for your favorite podcasts and listen to the episodes in a seamless UI and

Jeremy Kenedy 35 Dec 19, 2022
Nebula is a minimalistic and easy to use administration tool for Laravel applications, made with Laravel, Alpine.js, and Tailwind CSS.

Nebula Nebula is a minimalistic and easy to use administration tool for Laravel applications, made with Laravel, Alpine.js, and Tailwind CSS. Nebula m

Nebula 228 Nov 11, 2022
Laravel package to generate and to validate a UUID according to the RFC 4122 standard. Only support for version 1, 3, 4 and 5 UUID are built-in.

Laravel Uuid Laravel package to generate and to validate a universally unique identifier (UUID) according to the RFC 4122 standard. Support for versio

Christoph Kempen 1.7k Dec 28, 2022
An opinionated support package for Laravel, that provides flexible and reusable helper methods and traits for commonly used functionality.

Support An opinionated support package for Laravel, that provides flexible and reusable helper methods and traits for commonly used functionality. Ins

Ian Olson 3 Apr 14, 2021
Laravel blade directives and php helpers for serverside rendered content, based on browser window size WITHOUT css. Requires Livewire and AlpineJS.

Laravel Livewire Window Size and Breakpoints Laravel blade directives and php helpers for server side rendered content, based on browser window size W

Tina Hammar 15 Oct 6, 2022
Sweetalert and Toaster notifications for Laravel livewire with support for tailwind and bootstrap.

Larabell Integrate livewire with sweetalert. Installation How to use Sweetalert Toast Available configuration Installation composer require simtabi/la

Simtabi 3 Jul 27, 2022
Invoices, Expenses and Tasks built with Laravel and Flutter

Invoice Ninja Hosted | Self-Hosted We're on Slack, join us at slack.invoiceninja.com or if you like StackOverflow Just make sure to add the invoice-ni

Invoice Ninja 6.8k Dec 26, 2022
Fast and simple implementation of a REST API based on the Laravel Framework, Repository Pattern, Eloquent Resources, Translatability, and Swagger.

Laravel Headless What about? This allows a fast and simple implementation of a REST API based on the Laravel Framework, Repository Pattern, Eloquent R

Julien SCHMITT 6 Dec 30, 2022
Laravel 5 Flash Notifications with icons and animations and with a timeout

Notify (Laravel) Notify alert boxes to the browser with sound and font awesome icons and give it a timeout to fly out. Works great to notify the user

Ben-Piet O'Callaghan 31 Oct 8, 2022
An issue tracking tool based on laravel+reactjs for small and medium-sized enterprises, open-source and free, similar to Jira.

ActionView English | δΈ­ζ–‡ An issue tracking tool based on php laravel-framework in back-end and reactjs+redux in front-end, it's similar to Jira. You co

null 1.7k Dec 23, 2022
Log executed Laravel SQL queries and their line number and more

A lightweight laravel package for logging executed SQL queries, line number and more

Md.Harun-Ur-Rashid 31 Dec 21, 2022
Create and manage A Domain Driven Design (DDD) in your Laravel app, simply and efficiently.

Create and manage A Domain Driven Design (DDD) in your Laravel app, simply and efficiently.

Lucas Nepomuceno 4 Jun 11, 2022