2017 © Pedro Peláez
 

library files

A files component which allows you to read and write files

image

plinker/files

A files component which allows you to read and write files

  • Friday, May 11, 2018
  • by lcherone
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 14 Versions
  • 0 % Grown

The README.md

PlinkerRPC - Files

A files component which allows you to read and write files., (*1)

Install

Require this package with composer using the following command:, (*2)

``` bash $ composer require plinker/files, (*3)


## Client Creating a client instance is done as follows: <?php require 'vendor/autoload.php'; /** * Initialize plinker client. * * @param string $server - URL to server listener. * @param string $config - server secret, and/or a additional component data */ $client = new \Plinker\Core\Client( 'http://example.com/server.php', [ 'secret' => 'a secret password' ] ); // or using global function $client = plinker_client('http://example.com/server.php', 'a secret password'); ## Methods Once setup, you call the class though its namespace to its method. ### List List files and folders. | Parameter | Type | Description | Default | | ---------- | ------------- | ------------- | ------------- | | dir | string | Base path to list files and folders from | `./` | | extended | bool | Return extended fileinfo | `false` | | depth | int | Iterator depth | `10` | **Call** ``` php $result = $client->files->list('./', false, 10);

Response ``` text Array ( [/] => Array ( [0] => Array ( [name] => server.php [type] => file [size] => 706 ), (*4)

        [1] => Array
            (
                [name] => .plinker
                [type] => folder
                [size] => 4096
            )

        [3] => Array
            (
                [name] => user_classes
                [type] => folder
                [size] => 4096
            )

        [5] => Array
            (
                [name] => demo.php
                [type] => file
                [size] => 1628
            )

    )

[/.plinker] => Array
    (
        [2] => Array
            (
                [name] => crontab.journal
                [type] => file
                [size] => 45
            )

    )

[/user_classes] => Array
    (
        [4] => Array
            (
                [name] => demo.php
                [type] => file
                [size] => 345
            )

    )

), (*5)


**Response (with extended true)**

Array ( [/] => Array ( [0] => Array ( [name] => server.php [type] => file [size] => 706 [info] => Array ( [last_access] => 1525369379 [change_time] => 1525368118 [modified_time] => 1517173011 [basename] => server.php [extension] => php [filename] => server.php [group] => 33 [owner] => 33 [inode] => 3894233 [path] => . [pathname] => ./server.php [size] => 706 [type] => file [isDir] => [isExecutable] => [isFile] => 1 [isLink] => [readable] => 1 [writable] => 1 ), (*6)

            )
// snip..

### Create File Create/Put a file, if file already exists, it will be overwritten. | Parameter | Description | Default | | ---------- | ------------- | ------------- | | path | File path | | | contents | Contents of the file | | | flags | File operations flags | `0` | **Call** ``` php $result = $client->files->put('./path/to/file.txt', 'the file contents');

Response ``` text number of bytes written to file, (*7)


### Get File Get a file. | Parameter | Description | Default | | ---------- | ------------- | ------------- | | path | File path | | **Call** ``` php $result = $client->files->get('./path/to/file.txt');

Response ``` text the file contents, (*8)


### Delete File Delete a file. | Parameter | Description | Default | | ---------- | ------------- | ------------- | | path | File path | | **Call** ``` php $result = $client->files->delete('./path/to/file.txt');

Response ``` text, (*9)

```, (*10)

Testing

There are no tests setup for this component., (*11)

Contributing

Please see CONTRIBUTING for details., (*12)

Security

If you discover any security related issues, please contact me via https://cherone.co.uk instead of using the issue tracker., (*13)

Credits

Development Encouragement

If you use this project and make money from it or want to show your appreciation, please feel free to make a donation https://www.paypal.me/lcherone, thanks., (*14)

Sponsors

Get your company or name listed throughout the documentation and on each github repository, contact me at https://cherone.co.uk for further details., (*15)

License

The MIT License (MIT). Please see License File for more information., (*16)

See the organisations page for additional components., (*17)

The Versions

11/05 2018

dev-master

9999999-dev https://github.com/plinker-rpc

A files component which allows you to read and write files

  Sources   Download

MIT

11/05 2018

v0.2.7

0.2.7.0 https://github.com/plinker-rpc

A files component which allows you to read and write files

  Sources   Download

MIT

10/05 2018

v0.2.6

0.2.6.0 https://github.com/plinker-rpc

A files component which allows you to read and write files

  Sources   Download

MIT

08/05 2018

v0.2.5

0.2.5.0 https://github.com/plinker-rpc

A files component which allows you to read and write files

  Sources   Download

MIT

08/05 2018

v0.2.4

0.2.4.0 https://github.com/plinker-rpc

A files component which allows you to read and write files

  Sources   Download

MIT

08/05 2018

v0.2.3

0.2.3.0 https://github.com/plinker-rpc

A files component which allows you to read and write files

  Sources   Download

MIT

04/05 2018

v0.2.2

0.2.2.0 https://github.com/plinker-rpc

A files component which allows you to read and write files

  Sources   Download

MIT

04/05 2018

v0.2.1

0.2.1.0 https://github.com/plinker-rpc

A files component which allows you to read and write files

  Sources   Download

MIT

04/05 2018

v0.2.0

0.2.0.0 https://github.com/plinker-rpc

A files component which allows you to read and write files

  Sources   Download

MIT

04/05 2018

v0.1.0

0.1.0.0 https://github.com/plinker-rpc

A files component which allows you to read and write files

  Sources   Download

MIT