eden / file
File methods
Installs: 383 117
Dependents: 10
Suggesters: 0
Security: 0
Stars: 2
Watchers: 4
Forks: 6
Open Issues: 1
Requires
- php: >=5.4.1
- eden/array: 4.*
- eden/core: 4.*
- eden/path: 4.*
- eden/string: 4.*
This package is auto-updated.
Last update: 2024-11-13 21:38:33 UTC
README
====
Install
composer install eden/file
====
Introduction
Instantiate file in this manner.
$file = eden('file', '/some/path/to/file.txt');
====
API
====
isFile
Checks to see if this path is a real file
Usage
eden('file', '/some/path/to/file.txt')->isFile();
Parameters
Returns bool
====
getBase
Returns the base file name with out the extension
Usage
eden('file', '/some/path/to/file.txt')->getBase();
Parameters
Returns string
====
getContent
Returns the contents of a file given the path
Usage
eden('file', '/some/path/to/file.txt')->getContent();
Parameters
Returns string
====
getData
Returns the executes the specified file and returns the final value
Usage
eden('file', '/some/path/to/file.txt')->getData();
Parameters
Returns bool
====
getExtension
Returns the base file name extension
Usage
eden('file', '/some/path/to/file.txt')->getExtension();
Parameters
Returns string|null
====
getFolder
Returns the file path
Usage
eden('file', '/some/path/to/file.txt')->getFolder();
Parameters
Returns string
====
getMime
Returns the mime type of a file
Usage
eden('file', '/some/path/to/file.txt')->getMime();
Parameters
Returns string
====
getName
Returns the file name
Usage
eden('file', '/some/path/to/file.txt')->getName();
Parameters
Returns string
====
getSize
Returns the size of a file in bytes
Usage
eden('file', '/some/path/to/file.txt')->getSize();
Parameters
Returns string
====
getTime
Returns the last time file was modified in UNIX time
Usage
eden('file', '/some/path/to/file.txt')->getTime();
Parameters
Returns int
====
setContent
Creates a file and puts specified content into that file
Usage
eden('file', '/some/path/to/file.txt')->setContent(*string $content);
Parameters
*string $content
- The raw content to save
Returns Eden\File\Index
Example
eden('file', '/some/path/to/file.txt')->setContent('foo');
====
setData
Creates a php file and puts specified variable into that file
Usage
eden('file', '/some/path/to/file.txt')->setData(*mixed $variable);
Parameters
*mixed $variable
- Whatever data to save
Returns Eden\File\Index
Example
eden('file', '/some/path/to/file.txt')->setData($variable);
====
remove
Removes a file
Usage
eden('file', '/some/path/to/file.txt')->remove();
Parameters
Returns Eden\File\Index
====
touch
Touches a file (effectively creates the file if it doesn't exist and updates the date if it does)
Usage
eden('file', '/some/path/to/file.txt')->touch();
Parameters
Returns Eden\File\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.