====, (*1)
, (*2)
Install
composer install eden/file
, (*3)
====, (*4)
, (*5)
Introduction
Instantiate file in this manner., (*6)
$file = eden('file', '/some/path/to/file.txt');
====, (*7)
, (*8)
API
====, (*9)
, (*10)
isFile
Checks to see if this path is a real file, (*11)
Usage
eden('file', '/some/path/to/file.txt')->isFile();
Parameters
Returns bool
, (*12)
====, (*13)
, (*14)
getBase
Returns the base file name with out the extension, (*15)
Usage
eden('file', '/some/path/to/file.txt')->getBase();
Parameters
Returns string
, (*16)
====, (*17)
, (*18)
getContent
Returns the contents of a file given the path, (*19)
Usage
eden('file', '/some/path/to/file.txt')->getContent();
Parameters
Returns string
, (*20)
====, (*21)
, (*22)
getData
Returns the executes the specified file and returns the final value, (*23)
Usage
eden('file', '/some/path/to/file.txt')->getData();
Parameters
Returns bool
, (*24)
====, (*25)
, (*26)
getExtension
Returns the base file name extension, (*27)
Usage
eden('file', '/some/path/to/file.txt')->getExtension();
Parameters
Returns string|null
, (*28)
====, (*29)
, (*30)
getFolder
Returns the file path, (*31)
Usage
eden('file', '/some/path/to/file.txt')->getFolder();
Parameters
Returns string
, (*32)
====, (*33)
, (*34)
getMime
Returns the mime type of a file, (*35)
Usage
eden('file', '/some/path/to/file.txt')->getMime();
Parameters
Returns string
, (*36)
====, (*37)
, (*38)
getName
Returns the file name, (*39)
Usage
eden('file', '/some/path/to/file.txt')->getName();
Parameters
Returns string
, (*40)
====, (*41)
, (*42)
getSize
Returns the size of a file in bytes, (*43)
Usage
eden('file', '/some/path/to/file.txt')->getSize();
Parameters
Returns string
, (*44)
====, (*45)
, (*46)
getTime
Returns the last time file was modified in UNIX time, (*47)
Usage
eden('file', '/some/path/to/file.txt')->getTime();
Parameters
Returns int
, (*48)
====, (*49)
, (*50)
setContent
Creates a file and puts specified content into that file, (*51)
Usage
eden('file', '/some/path/to/file.txt')->setContent(*string $content);
Parameters
-
*string $content
- The raw content to save
Returns Eden\File\Index
, (*52)
Example
eden('file', '/some/path/to/file.txt')->setContent('foo');
====, (*53)
, (*54)
setData
Creates a php file and puts specified variable into that file, (*55)
Usage
eden('file', '/some/path/to/file.txt')->setData(*mixed $variable);
Parameters
-
*mixed $variable
- Whatever data to save
Returns Eden\File\Index
, (*56)
Example
eden('file', '/some/path/to/file.txt')->setData($variable);
====, (*57)
, (*58)
remove
Removes a file, (*59)
Usage
eden('file', '/some/path/to/file.txt')->remove();
Parameters
Returns Eden\File\Index
, (*60)
====, (*61)
, (*62)
touch
Touches a file (effectively creates the file if it doesn't exist and updates the date if it does), (*63)
Usage
eden('file', '/some/path/to/file.txt')->touch();
Parameters
Returns Eden\File\Index
, (*64)
====, (*65)
, (*66)
Contributing to Eden
Contributions to Eden are following the Github work flow. Please read up before contributing., (*67)
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.