我想在 m routes.php 文件上使用 Mobile Detect。我已在 composer.json 中将包添加为要求,并将其安装在供应商文件中。我现在如何使用它?
我尝试了这个答案但没有运气,因为找不到该类:Laravel 4 using vendor classes
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.2.*",
"mobiledetect/mobiledetectlib": "*"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable"
}
编辑:我尝试使用这个:https ://github.com/jenssegers/Laravel-Agent ,但别名从来没有工作过,说找不到类。