2017 © Pedro Peláez
 

library filepath

Generating a path for static files

image

teertz/filepath

Generating a path for static files

  • Saturday, February 18, 2017
  • by teertz
  • Repository
  • 1 Watchers
  • 1 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Filepath Generator

Introduction

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

The generated path is like this: BASE_DIR.'/vrt/ssd/tgh/';, (*2)

Basic Usage

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

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}, (*4)

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}, (*5)

Configuration with Laravel

Add the Filepath facade to the aliases array in your app configuration file:, (*6)

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

License

Teertz Filepath is open-sourced software licensed under the MIT license, (*7)

The Versions

18/02 2017

dev-master

9999999-dev

Generating a path for static files

  Sources   Download

MIT

The Requires

  • php >=5.0

 

by Chukhan Sergei

file generate path

12/10 2016

dev-dev

dev-dev

Generating a path for static files

  Sources   Download

MIT

The Requires

  • php >=5.0

 

by Chukhan Sergei

file generate path

12/10 2016

v1.0.3

1.0.3.0

Generating a path for static files

  Sources   Download

MIT

The Requires

  • php >=5.0

 

by Chukhan Sergei

file generate path

09/10 2016

v1.0.2

1.0.2.0

Generating a path for static files

  Sources   Download

MIT

The Requires

  • php >=5.0

 

by Chukhan Sergei

file generate path

09/10 2016

v1.0.1

1.0.1.0

Generating a path for static files

  Sources   Download

MIT

The Requires

  • php >=5.0

 

by Chukhan Sergei

file generate path

09/10 2016

v1.0

1.0.0.0

Generating a path for static files

  Sources   Download

MIT

The Requires

  • php >=5.0

 

by Chukhan Sergei

file generate path