2017 © Pedro Peláez
 

library path

image

dgifford/path

  • Thursday, March 2, 2017
  • by dgifford
  • Repository
  • 0 Watchers
  • 0 Stars
  • 8 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Path

A class for manipulating paths., (*1)

Usage

The class can be used non-statically:, (*2)

$path = new Path( '/path/to/a/file.ext' );

// Boolean check if the path exists
$path->exists();

// Boolean check if the path is writeable
$path->writeable();

// Get components of the path
$path->extension(); // returns 'ext'

// Get the path
$path->get(); // Returns '/path/to/a/file.ext'

// Change the path
$path->set('path/to/a/foo/../file.ext' );

// Resolve the path to a real path
$path->real()->get(); // Returns '/path/to/a/file.ext' or false if it doesn't exist

And statically:, (*3)

// Boolean check if a path exists
Path::exists( '/path/to/a/file.ext' );

// Boolean check if a path is writeable
Path::writeable( '/path/to/a/file.ext' );

// Get components of the path
Path::extension( '/path/to/a/file.ext' ); // returns 'ext'

// Resolve a path to a real path
Path::real('path/to/a/foo/../file.ext' ); // Returns '/path/to/a/file.ext' or false if it doesn't exist

The class can also accept multiple arguments:, (*4)

// Join strings to make a path
$path = new Path( '/path/', '/to/', '\a\', 'file.ext' );

$path->join()->get(); // Returns '/path/to/a/file.ext'

// Boolean check if any of the paths don't exist
$path->set( '/path/to/a/file.ext', 'foo bar', '/var/etc/' );

$path->exists(); // Returns false

// Boolean check if each of the paths exists
$path->exists( true ); // Returns [ true, false, true ]

The Versions

02/03 2017

dev-master

9999999-dev

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

02/03 2017

v0.3

0.3.0.0

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

02/03 2017

v0.2

0.2.0.0

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

24/02 2017

v0.1

0.1.0.0

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4