定制 teertz/filepath 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

teertz/filepath

Composer 安装命令:

composer require teertz/filepath

包简介

Generating a path for static files

README 文档

README

Introduction

Teertz Filepath provides a simple way to generate random paths for serving big amount of static files on the server (like user images)

The generated path is like this: BASE_DIR.'/vrt/ssd/tgh/';

Basic Usage

To get started with Teertz Filepath, add to your composer.json file as a dependency:

composer require teertz/filepath

Get the full path

<?php

use Teertz\Filepath\Generator as FilepathGenerator;

class SomeClass
{
    public function uploadSomePhoto($filename)
    {
        /* some work before */
        $filepath = new FilepathGenerator('/var/www/static/images/');
        /* some work after */
        
        return $filepath->getFullPath().$filename;

    }
}

You will get the BASE_DIR + random path like: /var/www/static/images/ddr/ggs/rrt/{filename}

Get generated path only

<?php

use Teertz\Filepath\Generator as FilepathGenerator;

class SomeClass
{
    public function uploadSomePhoto($filename)
    {
        /* some work before */
        $filepath = new FilepathGenerator('/var/www/static/images/');
        /* some work after */
        
        return $filepath->getGeneratedPath().$filename;

    }
}

You will get the random path like: /fth/asf/bkf/{filename}

Configuration with Laravel

Add the Filepath facade to the aliases array in your app configuration file:

'Filepath' => Teertz\Filepath\Generator::class,

License

Teertz Filepath is open-sourced software licensed under the MIT license

统计信息

  • 总下载量: 19
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固