Skip to content
Permalink
Browse files

Prepare the filesystem package for a subsplit.

Refs #6553
  • Loading branch information...
markstory committed May 16, 2015
1 parent 8e85e1c commit cb09cf69aa3311f6420afaae93abb010fa090161
Showing with 49 additions and 0 deletions.
  1. +1 −0 composer.json
  2. +32 −0 src/Filesystem/README.md
  3. +16 −0 src/Filesystem/composer.json
@@ -59,6 +59,7 @@
"cakephp/datasource": "self.version",
"cakephp/database": "self.version",
"cakephp/event": "self.version",
"cakephp/filesystem": "self.version",
"cakephp/i18n": "self.version",
"cakephp/log": "self.version",
"cakephp/orm": "self.version",
@@ -0,0 +1,32 @@
# CakePHP Filesystem Library

The Folder and File utilities are convenience classes to help you read from and write/append to files; list files within a folder and other common directory related tasks.

## Basic Usage

Create a folder instance and search for all the `.php` files within it:

```php
use Cake\Filesystem\Folder;
$dir = new Folder('/path/to/folder');
$files = $dir->find('.*\.ctp');
```

Now you can loop through the files and read from or write/append to the contents or simply delete the file:

```php
foreach ($files as $file) {
$file = new File($dir->pwd() . DS . $file);
$contents = $file->read();
// $file->write('I am overwriting the contents of this file');
// $file->append('I am adding to the bottom of this file.');
// $file->delete(); // I am deleting this file
$file->close(); // Be sure to close the file when you're done
}
```

## Documentation

Please make sure you check the [official
documentation](http://book.cakephp.org/3.0/en/core-libraries/file-folder.html)
@@ -0,0 +1,16 @@
{
"name": "cakephp/filesystem",
"description": "CakePHP filesystem convenience classes to help you work with files and folders.",
"license": "MIT",
"authors": [
{
"name": "CakePHP Community",
"homepage": "http://cakephp.org"
}
],
"autoload": {
"psr-4": {
"Cake\\Filesystem\\": "."
}
}
}

0 comments on commit cb09cf6

Please sign in to comment.
You can’t perform that action at this time.