eden / folder
File methods
Installs: 7 927
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 1
Open Issues: 0
Requires
- php: >=5.4.1
- eden/array: 4.*
- eden/core: 4.*
- eden/file: 4.*
- eden/path: 4.*
- eden/string: 4.*
This package is auto-updated.
Last update: 2024-12-13 21:35:33 UTC
README
====
Install
composer install eden/folder
====
Introduction
Instantiate folder in this manner.
$folder = eden('folder', '/some/path/to/folder');
====
API
====
create
Creates a folder given the path
Usage
eden('folder', '/some/path/to/folder')->create(int $chmod);
Parameters
int $chmod
- the UNIX permissions level
Returns Eden\Folder\Index
Example
eden('folder', '/some/path/to/folder')->create();
====
getFiles
Returns a list of files given the path and optionally the pattern
Usage
eden('folder', '/some/path/to/folder')->getFiles(string|null $regex, bool $recursive);
Parameters
string|null $regex
- Regular expression to match files againstbool $recursive
- To recursively look in folders
Returns array
Example
eden('folder', '/some/path/to/folder')->getFiles();
====
getFolders
Returns a list of folders given the path and optionally the regular expression
Usage
eden('folder', '/some/path/to/folder')->getFolders(string|null $regex, bool $recursive);
Parameters
string|null $regex
- Regular expression to match folders againstbool $recursive
- To recursively look in folders
Returns array
Example
eden('folder', '/some/path/to/folder')->getFolders();
====
getName
Returns the name of the directory.. just the name
Usage
eden('folder', '/some/path/to/folder')->getName();
Parameters
Returns string
- the name
====
isFolder
Checks to see if this path is a real file
Usage
eden('folder', '/some/path/to/folder')->isFolder(string|null $path);
Parameters
string|null $path
- the path to test against
Returns bool
Example
eden('folder', '/some/path/to/folder')->isFolder();
====
remove
Removes a folder given the path
Usage
eden('folder', '/some/path/to/folder')->remove();
Parameters
Returns Eden\Folder\Index
====
removeFiles
Removes files given the path and optionally a regular expression
Usage
eden('folder', '/some/path/to/folder')->removeFiles(string|null regular);
Parameters
string|null regular
- expression
Returns Eden\Folder\Index
Example
eden('folder', '/some/path/to/folder')->removeFiles();
====
removeFolders
Removes a folder given the path and optionally the regular expression
Usage
eden('folder', '/some/path/to/folder')->removeFolders(string $regex);
Parameters
string $regex
- Regular expression to test against
Returns Eden\Folder\Index
Example
eden('folder', '/some/path/to/folder')->removeFolders();
====
truncate
Removes files and folder given a path
Usage
eden('folder', '/some/path/to/folder')->truncate();
Parameters
Returns Eden\Folder\Index
====
Contributions to Eden are following the Github work flow. Please read up before contributing.
##Setting up your machine with the Eden repository and your fork
- Fork the repository
- Fire up your local terminal create a new branch from the
v4
branch of your fork with a branch name describing what your changes are. Possible branch name types:- bugfix
- feature
- improvement
- Make your changes. Always make sure to sign-off (-s) on all commits made (git commit -s -m "Commit message")
##Making pull requests
- Please ensure to run
phpunit
before making a pull request. - Push your code to your remote forked version.
- Go back to your forked version on GitHub and submit a pull request.
- An Eden developer will review your code and merge it in when it has been classified as suitable.