{"id":23479474,"url":"https://github.com/plinker-rpc/files","last_synced_at":"2025-04-13T17:59:09.918Z","repository":{"id":57042714,"uuid":"118975779","full_name":"plinker-rpc/files","owner":"plinker-rpc","description":"A files component which allows you to read and write files.","archived":false,"fork":false,"pushed_at":"2018-05-11T16:20:17.000Z","size":182,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-16T08:15:49.548Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://plinker-rpc.github.io/files/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plinker-rpc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-25T22:35:31.000Z","updated_at":"2018-05-11T16:19:58.000Z","dependencies_parsed_at":"2022-08-23T23:40:12.627Z","dependency_job_id":null,"html_url":"https://github.com/plinker-rpc/files","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plinker-rpc%2Ffiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plinker-rpc%2Ffiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plinker-rpc%2Ffiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plinker-rpc%2Ffiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plinker-rpc","download_url":"https://codeload.github.com/plinker-rpc/files/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248758435,"owners_count":21156957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-24T19:29:44.390Z","updated_at":"2025-04-13T17:59:09.896Z","avatar_url":"https://github.com/plinker-rpc.png","language":"PHP","readme":"# PlinkerRPC - Files\n\nA files component which allows you to read and write files.\n\n## Install\n\nRequire this package with composer using the following command:\n\n``` bash\n$ composer require plinker/files\n```\n\n## Client\n\nCreating a client instance is done as follows:\n\n\n    \u003c?php\n    require 'vendor/autoload.php';\n\n    /**\n     * Initialize plinker client.\n     *\n     * @param string $server - URL to server listener.\n     * @param string $config - server secret, and/or a additional component data\n     */\n    $client = new \\Plinker\\Core\\Client(\n        'http://example.com/server.php',\n        [\n            'secret' =\u003e 'a secret password'\n        ]\n    );\n    \n    // or using global function\n    $client = plinker_client('http://example.com/server.php', 'a secret password');\n    \n\n## Methods\n\nOnce setup, you call the class though its namespace to its method.\n\n### List\n\nList files and folders.\n\n| Parameter   | Type           | Description   | Default        |\n| ----------  | -------------  | ------------- |  ------------- | \n| dir         | string         | Base path to list files and folders from | `./` |\n| extended    | bool           | Return extended fileinfo | `false` |\n| depth       | int            | Iterator depth | `10` |\n\n\n**Call**\n``` php\n$result = $client-\u003efiles-\u003elist('./', false, 10);\n```\n\n**Response**\n``` text\nArray\n(\n    [/] =\u003e Array\n        (\n            [0] =\u003e Array\n                (\n                    [name] =\u003e server.php\n                    [type] =\u003e file\n                    [size] =\u003e 706\n                )\n\n            [1] =\u003e Array\n                (\n                    [name] =\u003e .plinker\n                    [type] =\u003e folder\n                    [size] =\u003e 4096\n                )\n\n            [3] =\u003e Array\n                (\n                    [name] =\u003e user_classes\n                    [type] =\u003e folder\n                    [size] =\u003e 4096\n                )\n\n            [5] =\u003e Array\n                (\n                    [name] =\u003e demo.php\n                    [type] =\u003e file\n                    [size] =\u003e 1628\n                )\n\n        )\n\n    [/.plinker] =\u003e Array\n        (\n            [2] =\u003e Array\n                (\n                    [name] =\u003e crontab.journal\n                    [type] =\u003e file\n                    [size] =\u003e 45\n                )\n\n        )\n\n    [/user_classes] =\u003e Array\n        (\n            [4] =\u003e Array\n                (\n                    [name] =\u003e demo.php\n                    [type] =\u003e file\n                    [size] =\u003e 345\n                )\n\n        )\n\n)\n```\n\n**Response (with extended true)**\n```\nArray\n(\n    [/] =\u003e Array\n        (\n            [0] =\u003e Array\n                (\n                    [name] =\u003e server.php\n                    [type] =\u003e file\n                    [size] =\u003e 706\n                    [info] =\u003e Array\n                        (\n                            [last_access] =\u003e 1525369379\n                            [change_time] =\u003e 1525368118\n                            [modified_time] =\u003e 1517173011\n                            [basename] =\u003e server.php\n                            [extension] =\u003e php\n                            [filename] =\u003e server.php\n                            [group] =\u003e 33\n                            [owner] =\u003e 33\n                            [inode] =\u003e 3894233\n                            [path] =\u003e .\n                            [pathname] =\u003e ./server.php\n                            [size] =\u003e 706\n                            [type] =\u003e file\n                            [isDir] =\u003e \n                            [isExecutable] =\u003e \n                            [isFile] =\u003e 1\n                            [isLink] =\u003e \n                            [readable] =\u003e 1\n                            [writable] =\u003e 1\n                        )\n\n                )\n    // snip..\n```\n\n### Create File\n\nCreate/Put a file, if file already exists, it will be overwritten.\n\n| Parameter    | Description | Default |\n| ----------   | ------------- |  ------------- | \n| path | File path |  |\n| contents | Contents of the file |  |\n| flags | File operations flags | `0` |\n\n**Call**\n``` php\n$result = $client-\u003efiles-\u003eput('./path/to/file.txt', 'the file contents');\n```\n\n**Response**\n``` text\nnumber of bytes written to file\n```\n\n### Get File\n\nGet a file.\n\n| Parameter    | Description | Default |\n| ----------   | ------------- |  ------------- | \n| path | File path |  |\n\n**Call**\n``` php\n$result = $client-\u003efiles-\u003eget('./path/to/file.txt');\n```\n\n**Response**\n``` text\nthe file contents\n```\n\n### Delete File\n\nDelete a file.\n\n| Parameter    | Description | Default |\n| ----------   | ------------- |  ------------- | \n| path | File path |  |\n\n**Call**\n``` php\n$result = $client-\u003efiles-\u003edelete('./path/to/file.txt');\n```\n\n**Response**\n``` text\n\n```\n\n## Testing\n\nThere are no tests setup for this component.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/plinker-rpc/files/blob/master/CONTRIBUTING) for details.\n\n## Security\n\nIf you discover any security related issues, please contact me via [https://cherone.co.uk](https://cherone.co.uk) instead of using the issue tracker.\n\n## Credits\n\n- [Lawrence Cherone](https://github.com/lcherone)\n- [All Contributors](https://github.com/plinker-rpc/files/graphs/contributors)\n\n\n## Development Encouragement\n\nIf you use this project and make money from it or want to show your appreciation,\nplease feel free to make a donation [https://www.paypal.me/lcherone](https://www.paypal.me/lcherone), thanks.\n\n## Sponsors\n\nGet 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.\n\n## License\n\nThe MIT License (MIT). Please see [License File](https://github.com/plinker-rpc/files/blob/master/LICENSE) for more information.\n\nSee the [organisations page](https://github.com/plinker-rpc) for additional components.\n","funding_links":["https://www.paypal.me/lcherone"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplinker-rpc%2Ffiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplinker-rpc%2Ffiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplinker-rpc%2Ffiles/lists"}