Code Monkey home page Code Monkey logo

qiniu_static_cdn's Introduction

qiniu_static_cdn

laravel静态文件上传到七牛云扩展包

安装

$ composer require tradzero/qiniu_static_cdn:dev-master -vvv

更改laravel项目下/config/app.php

'providers' => [
    // Other service providers...
    Tradzero\Uploader\UploaderServiceProvider::class,
],

将配置文件复制到项目目录下:

$ php artisan vendor:publish --provider=Tradzero\Uploader\UploaderServiceProvider

更改配置文件:

<?php

return [
    'cache_prefix' => 'staticupload',
    
    'qiniu_accessKey' => env('QINIU_AK', ''), // 更改为七牛云的AccessKey 可以在七牛云 个人中心 密钥管理中找到
    'qiniu_secretKey' => env('QINIU_SK', ''), // 更改为七牛云的SecretKey 可以在七牛云 个人中心 密钥管理中找到
    'qiniu_bucket' => env('QINIU_BUCKET', ''), // 七牛云使用的存储空间名
    'qiniu_domain' => env('QINIU_URL', ''), // 七牛云使用的存储空间所对应的空间域名
];

使用

上传

在命令行使用laravel的命令行

$ php artisan uploader:upload #可以使用--folder指定目录 该目录相对于项目根目录

将自动遍历目录下的文件上传到七牛云

helper 帮助方法

cdnAsset('/XX/XX') // 可以自动生成资源文件路径

感谢

这里借鉴了Overtrue的flysystem-qiniu的部分上传代码

License

MIT

qiniu_static_cdn's People

Contributors

tradzero avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.