app.php 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /**
  3. * @desc app.php 描述信息
  4. *
  5. * @author Tinywan(ShaoBo Wan)
  6. * @date 2022/3/10 19:46
  7. */
  8. return [
  9. 'enable' => true,
  10. 'storage' => [
  11. 'default' => 'local', // local:本地 oss:阿里云 cos:腾讯云 qos:七牛云
  12. 'single_limit' => 1024 * 1024 * 200, // 单个文件的大小限制,默认200M 1024 * 1024 * 200
  13. 'total_limit' => 1024 * 1024 * 200, // 所有文件的大小限制,默认200M 1024 * 1024 * 200
  14. 'nums' => 10, // 文件数量限制,默认10
  15. 'chunk_size' => 1024 * 1024 * 5, // 分片上传:单个分片的大小限制,默认5M
  16. 'chunk_path' => runtime_path() . '/storage/.chunks', // 分片上传:分片暂存/会话目录(云端适配器必需),默认 {root}/.chunks
  17. 'include' => [], // 被允许的文件类型列表
  18. 'exclude' => [], // 不被允许的文件类型列表
  19. // 本地对象存储
  20. 'local' => [
  21. 'adapter' => \Tinywan\Storage\Adapter\LocalAdapter::class,
  22. 'root' => public_path() . '/storage',
  23. 'dirname' => function () {
  24. return date('Ymd');
  25. },
  26. 'domain' => 'http://127.0.0.1:8787',
  27. // uri 必须与 root 相对 public 目录的路径一致(此处 root 为 public/storage),否则生成的 url 无法访问
  28. 'uri' => '/storage',
  29. 'algo' => 'sha1',
  30. 'chunk_path' => runtime_path() . '/storage/.chunks', // 分片上传:分片临时存储目录
  31. ],
  32. // 阿里云对象存储
  33. 'oss' => [
  34. 'adapter' => \Tinywan\Storage\Adapter\OssAdapter::class,
  35. 'accessKeyId' => 'xxxxxxxxxxxx',
  36. 'accessKeySecret' => 'xxxxxxxxxxxx',
  37. 'bucket' => 'resty-webman',
  38. 'dirname' => function () {
  39. return 'storage';
  40. },
  41. 'domain' => 'http://webman.oss.tinywan.com',
  42. 'endpoint' => 'oss-cn-hangzhou.aliyuncs.com',
  43. 'algo' => 'sha1',
  44. ],
  45. // 腾讯云对象存储
  46. 'cos' => [
  47. 'adapter' => \Tinywan\Storage\Adapter\CosAdapter::class,
  48. 'secretId' => 'xxxxxxxxxxxxx',
  49. 'secretKey' => 'xxxxxxxxxxxx',
  50. 'bucket' => 'resty-webman-xxxxxxxxx',
  51. 'dirname' => 'storage',
  52. 'domain' => 'http://webman.oss.tinywan.com',
  53. 'region' => 'ap-shanghai',
  54. ],
  55. // 七牛云对象存储
  56. 'qiniu' => [
  57. 'adapter' => \Tinywan\Storage\Adapter\QiniuAdapter::class,
  58. 'accessKey' => 'xxxxxxxxxxxxx',
  59. 'secretKey' => 'xxxxxxxxxxxxx',
  60. 'bucket' => 'resty-webman',
  61. 'dirname' => 'storage',
  62. 'domain' => 'http://webman.oss.tinywan.com',
  63. ],
  64. // aws
  65. 's3' => [
  66. 'adapter' => \Tinywan\Storage\Adapter\S3Adapter::class,
  67. 'key' => 'xxxxxxxxxxxxx',
  68. 'secret' => 'xxxxxxxxxxxxx',
  69. 'bucket' => 'resty-webman',
  70. 'dirname' => 'storage',
  71. 'domain' => 'http://webman.oss.tinywan.com',
  72. 'region' => 'S3_REGION',
  73. 'version' => 'latest',
  74. 'use_path_style_endpoint' => true,
  75. 'endpoint' => 'S3_ENDPOINT',
  76. 'acl' => 'public-read',
  77. ],
  78. ],
  79. ];