andrewelkins/cabinet
Composer 安装命令:
composer require andrewelkins/cabinet
包简介
Laravel 4 file upload package.
README 文档
README
Cabinet is a file upload package for Laravel 4.
Cabinet is a package that allows easy upload of files and images.
Features
- File Upload
- Image Processing for display
- Configurable Image options
- Route, Controller, Model cli generators
- Configurable
Quick start
Required setup
In the require key of composer.json file add the following:
For use with Laravel 4.1.x
"andrewelkins/cabinet": "1.0.x"
For use with Laravel 4.2.x
"andrewelkins/cabinet": "1.1.x"
Run the Composer update command
$ composer update
In your config/app.php add 'Andrew13\Cabinet\CabinetServiceProvider' to the end of the $providers array
'providers' => array( 'Illuminate\Foundation\Providers\ArtisanServiceProvider', 'Illuminate\Auth\AuthServiceProvider', ... 'Andrew13\Cabinet\CabinetServiceProvider', ),
At the end of config/app.php add 'Cabinet' => 'Andrew13\Cabinet\CabinetFacade' to the $aliases array
'aliases' => array( 'App' => 'Illuminate\Support\Facades\App', 'Artisan' => 'Illuminate\Support\Facades\Artisan', ... 'Cabinet' => 'Andrew13\Cabinet\CabinetFacade', ),
Upload model
Now generate the Cabinet migration:
$ php artisan cabinet:migration
It will generate the <timestamp>_cabinet_setup_uploads_table.php migration. You may now run it with the artisan migrate command:
$ php artisan migrate
It will setup a table containing filename, directory_path, extension, user_id and deleted_at fields, which are the default fields needed for Cabinet use.
Create an upload model in app/models/Upload.php:
<?php use Andrew13\Cabinet\CabinetUpload; class Upload extends CabinetUpload { protected $softDelete = true; }
CabinetUpload class will take care of all the default upload behavior. This can be extended in your Upload model.
Dump the default assessors
Least, you can dump a default controller and the default routes for Cabinet.
$ php artisan cabinet:controller $ php artisan cabinet:routes
Don't forget to dump composer autoload
$ composer dump-autoload
Publish public assets
In order to use the js/css/images you'll need to publish the assets.
$ php artisan asset:publish andrewelkins/cabinet
And you are ready to go.
Access http://localhost/upload to upload a file. It is highly suggested to put some auth protection on the uploads.
Advanced
Using custom table / model name
To change the controller name when dumping the default controller template you can use the --name option.
$ php artisan cabinet:controller --name Uploader
Will result in UploaderController
Then, when dumping the routes, you should use the --controller option to match the existing controller.
$ php artisan confide:routes --controller Uploader
Using custom form for upload and other configuration options.
First, publish the config files:
$ php artisan config:publish andrewelkins/cabinet
Then edit the view names in app/config/packages/andrewelkins/confide/config.php.
Further, you can change the location of the uploads, type of upload files, and many more options!
RESTful controller
If you want to generate a RESTful controller you can use the additional --restful or -r option.
$ php artisan cabinet:controller --restful
Will result in a RESTful controller
Then, when dumping the routes, you should use the --restful option to match the existing controller.
$ php artisan cabinet:routes --restful
License
This is free software distributed under the terms of the MIT license
Special Thanks
Generator code uses code from the Confide package. It is then modified to fit this application. Thanks goes out to @Zizaco for that code.
Workbench tutorial by Jason Lewis was excellent in getting up and running with workbench.
Image upload tutorial from Phil Sturgeon which inspired me to create this package.
Additional information
Any questions, feel free to contact me.
andrewelkins/cabinet 适用场景与选型建议
andrewelkins/cabinet 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 1.69k 次下载、GitHub Stars 达 101, 最近一次更新时间为 2014 年 09 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「file」 「jquery」 「JS」 「laravel」 「uploads」 「illuminate」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 andrewelkins/cabinet 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 andrewelkins/cabinet 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 andrewelkins/cabinet 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
This is a laravel 4 package for the server and client side of datatables at http://datatables.net/
Laravel Media Popup to upload/view the files
A jQuery augmented PHP library for creating and validating HTML forms
PMVC Plugin for File information
统计信息
- 总下载量: 1.69k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 101
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-09-24