Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/plinker-rpc/files
A files component which allows you to read and write files.
https://github.com/plinker-rpc/files
Last synced: 12 days ago
JSON representation
A files component which allows you to read and write files.
- Host: GitHub
- URL: https://github.com/plinker-rpc/files
- Owner: plinker-rpc
- License: mit
- Created: 2018-01-25T22:35:31.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-11T16:20:17.000Z (over 6 years ago)
- Last Synced: 2024-12-22T09:41:12.529Z (14 days ago)
- Language: PHP
- Homepage: https://plinker-rpc.github.io/files/
- Size: 178 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING
- License: LICENSE
Awesome Lists containing this project
README
# PlinkerRPC - Files
A files component which allows you to read and write files.
## Install
Require this package with composer using the following command:
``` bash
$ composer require plinker/files
```## Client
Creating a client instance is done as follows:
'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
)[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
))
)
```**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
))
// 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
```### 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
```### Delete File
Delete a file.
| Parameter | Description | Default |
| ---------- | ------------- | ------------- |
| path | File path | |**Call**
``` php
$result = $client->files->delete('./path/to/file.txt');
```**Response**
``` text```
## Testing
There are no tests setup for this component.
## Contributing
Please see [CONTRIBUTING](https://github.com/plinker-rpc/files/blob/master/CONTRIBUTING) for details.
## Security
If you discover any security related issues, please contact me via [https://cherone.co.uk](https://cherone.co.uk) instead of using the issue tracker.
## Credits
- [Lawrence Cherone](https://github.com/lcherone)
- [All Contributors](https://github.com/plinker-rpc/files/graphs/contributors)## 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](https://www.paypal.me/lcherone), thanks.## Sponsors
Get your company or name listed throughout the documentation and on each github repository, contact me at [https://cherone.co.uk](https://cherone.co.uk) for further details.
## License
The MIT License (MIT). Please see [License File](https://github.com/plinker-rpc/files/blob/master/LICENSE) for more information.
See the [organisations page](https://github.com/plinker-rpc) for additional components.