Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to discover packages in special directory with Laravel 5.5?

Tags:

php

laravel

I want to create my own Laravel 5.5 Package, I put them in /packages/myvendor/mypackage. Is there any way to make Laravel Package Auto-Discovery seen my packages without adding MyServiceProvider::class to config/app.php?

like image 656
HuynhAT Avatar asked Oct 16 '17 08:10

HuynhAT


People also ask

Where are Laravel packages stored?

Laravel's filesystem configuration file is located at config/filesystems.php .

What are the different directory of a Laravel php?

The Routes Directory By default, several route files are included with Laravel: web.php , api.php , console.php , and channels.php . The web.php file contains routes that the RouteServiceProvider places in the web middleware group, which provides session state, CSRF protection, and cookie encryption.

What is config directory in Laravel?

All of the configuration files for the Laravel framework are stored in the app/config directory. Each option in every file is documented, so feel free to look through the files and get familiar with the options available to you. Sometimes you may need to access configuration values at run-time.

What does the vendor directory contains in Laravel?

Laravel's Vendor directory The vendor directory contains the composer dependencies, for example, to install Laravel setup, the composer is required. The vendor folder contains all the composer dependencies.


1 Answers

I found the solution! I add my local packages to composer.json with

"repositories": [
        {
            "type": "path",
            "url": "packages/vendor/package",
            "options": {
                "symlink": true
            }
        }
    ]

Then require my package with composer require vendor/package:dev-master. Then laravel will auto discover my package

like image 132
HuynhAT Avatar answered Oct 16 '22 15:10

HuynhAT