[英]Autoload php files in Laravel 4
I have a library called macro
that I want to include in my project. 我有一个想要在项目中包含的macro
库。 I want to autoload all the files in the folder lib
: 我想自动加载lib
目录中的所有文件:
app
| ...
| lib
| | macro
| | | Search.php
| | | SearchFacade.php
| | | SearchServiceProvider.php
| | otherlib
| | | ...
| | lib4
| ...
| filters.php
| routes.php
What do I need to do to autoload all the files in the folder lib , I am using Xampp
, and I am running Windows 8
. 我要怎么做才能自动加载文件夹lib中的所有文件 ,我正在使用Xampp
,并且我正在运行Windows 8
。
Is it also possible to include in that folder a few standard stylesheets
and javascript scripts
? 是否还可以在该文件夹中包含一些标准stylesheets
和javascript scripts
?
Change the autoload section in your composer.json
and add app/lib
to it 更改composer.json
的autoload部分,并向其中添加app/lib
autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php",
"app/lib",
],
Then just run composer dump-autoload
in the command line to update the autoloader. 然后只需在命令行中运行composer dump-autoload
即可更新自动加载器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.