在L3中,我设法创建了一个模块系统,在这个系统中,我能够从管理区域安装/卸载模块。
if(!Bundle::exists($name))
{
// Load the bundle
// If a routes file exists then we'll assume it handles routes of it's own name.
// Remember, if you need it to handle a custom route you should manually add
// the bundle in application/bundles.php.
Bundle::register($name, array(
'handles' => File::exists($path.DS.'routes.php') ? $name : null,
'location' => 'path: '.$path,
'auto' => true)
);
// autobundle is already in the loop that's starting bundles so we
// can't let the normal mechanism start it. We'll start it here.
Bundle::start($name);
}
我怎么能在L4做到呢?L4对我来说看起来很不一样,我2个月前开始使用L3(第一个框架)
或者如果你仍然想要更特定于应用程序的模块,你可以查看我的教程:http://creolab.hr/2013/05/modules-in-laravel-4/
我将很快展开这篇文章,解释如何构建一个简单的接口来激活/取消激活这些模块。
bundle现在是Packages,它实际上是存储在不同位置的可重用PHP代码库,并由Packagist索引(可与Composer一起安装)。
为了做基于Laravel的包开发,你需要检查这个文档:http://laravel.com/docs/packages,它应该帮助你。