简体   繁体   English

Laravel 如何从 config\app.php => 提供者中自动加载所有提供者类

[英]How Laravel auto load all provider classes from config\app.php => providers

I wonder how does laravel load all the classes which was registered in config\app.php .我想知道 laravel 如何加载在config\app.php中注册的所有类。 在此处输入图像描述

because I am trying to same thing with another project (non laravel framework) where I need to register module class by array.因为我正在尝试与另一个项目(非 laravel 框架)做同样的事情,我需要通过数组注册模块 class。 like this像这样

class Module {

        public function __construct()
        {
            $this->register();
        }

        public function register()
        {
            return [
                \Modules\Quiz::class,
                \Modules\Library::class,
                \Modules\Payment::class,
            ];
        }
    }

Providers not for loading classes.提供程序不用于加载类。 Please look up spl_autoload_register on php.net请在 php.net 上查找 spl_autoload_register

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Laravel 5中config / app.php提供者数组中:: class的含义是什么 - What is the meaning of ::class in config/app.php provider array in Laravel 5 如何修复config / app.php Laravel中的提供程序,它始终未找到错误 - How to fix provider in config/app.php Laravel that's starting not found error laravel如何阅读app / config / app.php调试变量 - laravel how to read app/config/app.php debug variable 如何从 Laravel 的 config/app.php 中获取客户端 ip 地址? - How to get the client ip address from Laravel's config/app.php? 我们如何从数据库或laravel 5 config文件夹中app.php的其他文件中访问数据 - how do we access data from database or other files in app.php of the config folder in laravel 5 Laravel软件包是否需要在app.php中注册服务提供商? - Is registering a Service Provider in app.php required for Laravel packages? 将会话连接到Laravel 5.2中的config / app.php设置 - Concatenate session to config/app.php setting in Laravel 5.2 Laravel config/app.php 和.env 文件中的应用程序环境变量 - Laravel Application Environment variable in config/app.php and .env file config \\ app.php从数据库获取值 - config\app.php getting values from database 如何阅读config / app.php中定义的“电子邮件”选项? - How to read the 'Email' options defined in config/app.php?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM