{"id":21214782,"url":"https://github.com/filestack/filestack-php","last_synced_at":"2025-04-09T06:11:53.305Z","repository":{"id":37546008,"uuid":"89370500","full_name":"filestack/filestack-php","owner":"filestack","description":"Official PHP SDK for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.","archived":false,"fork":false,"pushed_at":"2024-09-18T18:21:37.000Z","size":27528,"stargazers_count":57,"open_issues_count":20,"forks_count":32,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-02T02:12:08.341Z","etag":null,"topics":["documentation","filestack","php","sdk","transforming-files","upload-file","upload-images"],"latest_commit_sha":null,"homepage":"https://www.filestack.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/filestack.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-25T14:31:15.000Z","updated_at":"2024-12-30T08:02:08.000Z","dependencies_parsed_at":"2025-01-14T05:30:36.803Z","dependency_job_id":null,"html_url":"https://github.com/filestack/filestack-php","commit_stats":{"total_commits":120,"total_committers":9,"mean_commits":"13.333333333333334","dds":0.2583333333333333,"last_synced_commit":"66718d4625dceae0c710ec8be5fb9efc9e0fcc12"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filestack%2Ffilestack-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filestack%2Ffilestack-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filestack%2Ffilestack-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filestack%2Ffilestack-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/filestack","download_url":"https://codeload.github.com/filestack/filestack-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987285,"owners_count":21028895,"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":["documentation","filestack","php","sdk","transforming-files","upload-file","upload-images"],"created_at":"2024-11-20T21:30:52.075Z","updated_at":"2025-04-09T06:11:53.287Z","avatar_url":"https://github.com/filestack.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"logo.svg\" align=\"center\" width=\"100\"/\u003e\u003c/p\u003e\n\u003ch1 align=\"center\"\u003eFilestack PHP\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://travis-ci.org/filestack/filestack-php\"\u003e\n    \u003cimg src=\"https://img.shields.io/travis/filestack/filestack-php.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://coveralls.io/github/filestack/filestack-php?branch=master\"\u003e\n    \u003cimg src=\"https://coveralls.io/repos/github/filestack/filestack-php/badge.svg?branch=master\"\u003e\n  \u003c/a\u003e\n   \u003ca href=\"https://codeclimate.com/github/filestack/filestack-php\"\u003e\n    \u003cimg src=\"https://codeclimate.com/github/filestack/filestack-php/badges/gpa.svg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\nThis is the official PHP SDK for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.\n\n## Requirements\n\n* PHP 8.3+\n\n## Resources\n\n* [Filestack](https://www.filestack.com)\n* [Documentation](https://www.filestack.com/docs)\n\n## Installing\n\nInstall ``filestack`` with composer, either run\n\n    $ composer require --prefer-dist filestack/filestack-php\n\n## Usage\n\nFilestack library gives you access to three useful classes:\n\n* `FilestackClient` - for easy file upload (creates Filelink objects)\n* `Filelink` - for file handling (downloading, converting etc.)\n* `FileSecurity` - for applying policy and signature values to your API calls\n\n### Uploading files\nFirst, you need to create an instance of FilestackClient\n\n```php\nuse Filestack\\FilestackClient;\n\n$client = new FilestackClient('YOUR_API_KEY');\n```\n\nCall the upload() function\n\n```php\n\n$filelink = $client-\u003eupload('/path/to/file');\n\n```\n\n### Storage\n\nAmazon S3 is used to store your files by default. If you wish to use a different one, you can pass in additional parameter 'location' when making upload() and store calls\n\n```php\n$client = new FilestackClient('YOUR_API_KEY');\n$extras = [\n    'Location' =\u003e 'dropbox',\n    'Filename' =\u003e 'somefilename.jpg',\n];\n\n$filepath = '/path/to/file';\n$filelink = $client-\u003eupload($filepath);\n\n# get metadata of file\n$metadata = $client-\u003egetMetaData($filelink-\u003ehandle, $fields);\n\n# get content of a file\n$content = $client-\u003egetContent($filelink-\u003ehandle);\n\n# download a file\n$destination = '/path/to/file';\n$result = $client-\u003edownload($filelink-\u003ehandle, $destination);\n\n# overwrite a file\n$filelink2 = $client-\u003eoverwrite('/path/to/file', $filelink-\u003ehandle);\n```\n\n### Manipulating files\n\nFilelink objects can be created in two ways:\n\n - by uploading a file using FilestackClient\n - by initializing Filelink with file handle and api_key\n\nFirst method was shown above, the second method is also very easy and will create objects representing files that were already uploaded.\n\n```php\nuse Filestack\\filelink;\n\n$filelink = new Filelink('some-file-handle', 'YOUR_API_KEY');\n\n# transforming an image\n$transformed_filelink = $filelink\n            -\u003ecircle()\n            -\u003eblur(['amount' =\u003e '20'])\n            -\u003esave();\n\n# get metadata\n$metadata = $filelink-\u003egetMetaData();\n\n# get content of a file\n$content = $filelink-\u003egetContent();\n\n$filepath = '/path/to/file';\n\n# download a file\n$filelink-\u003edownload($filepath);\n\n# overwrite remote file with local file\n$filelink-\u003eoverwrite($filepath);\n\n# delete remote file\n$filelink-\u003edelete();\n\n```\n\n### Tagging files and detecting safe for work content\n\n```php\nuse Filestack\\FilestackClient;\nuse Filestack\\FilestackSecurity;\n\n$security = new FilestackSecurity('YOUR_SECURITY_SECRET');\n$client = new FilestackClient('YOUR_API_KEY', $security);\n\n$file_handle = 'some-file-handle';\n\n# get tags with client\n$result_json = $client-\u003egetTags($file_handle);\n\n# get tags with filelink\n$filelink = new Filelink($file_handle, 'YOUR_API_KEY', $security);\n\n$json_result = $filelink-\u003egetTags();\n\n# get safe for work flag with client\n$result_json = $client-\u003egetSafeForWork($file_handle);\n\n# get safe for work flag with filelink\n$json_result = $filelink-\u003egetSafeForWork();\n\n```\n\nFor more examples, see the [examples/](examples/) folder in this project.\n\n## Intelligent Ingestion\n\nThe Intelligent Ingestion feature allows user to upload a file in chunks of\nnot precised size. This creates a more stable upload flow that ensures the\nfile being uploaded will eventually complete successfully, regardless of\nnetwork latency or timeout errors.\n\nHowever, the upload process may be slower than the normal upload flow for\nlarge files, as there are errors are retried using the exponential backoff\nretry strategy.\n\nLastly, this feature has to be turned on for the apikey being used.  To turn\non this feature please contact Filestack at support@filestack.com.\n\n```\n$client = new FilestackClient('YOUR_API_KEY');\n$filelink = $client-\u003eupload('/path/to/file', ['intelligent' =\u003e true]);\n```\n\n## Versioning\n\nFilestack PHP SDK follows the [Semantic Versioning](http://semver.org/).\n\n## Code Standard\n\n- PSR-2 coding standard (http://www.php-fig.org/psr/psr-2/)\n- PSR-4 autoloading standard (http://www.php-fig.org/psr/psr-4/)\n- phpDoc documentation comments standard (https://www.phpdoc.org/docs/latest/getting-started/your-first-set-of-documentation.html)\n\n## Testing\n\n- To run tests, from the project root director, run\n```\nvendor/bin/phpunit\n```\n\n- To generate coverage report, run following command (will generage html files under\ndirectory coverage/)\n```\nvendor/bin/phpunit --coverage-xml=coverage\n```\n\n- To run PHPMD for CodeClimate checks\n```\nvendor/bin/phpmd filestack xml phpmd-rules.xml \u003e logs/phpmd-report-filestack.xml\nvendor/bin/phpmd tests xml phpmd-rules.xml \u003e logs/phpmd-report-tests.xml\n```\n\n## Generating documentation\n\nTo get project metrics use phar file for https://github.com/sebastianbergmann/phploc\n\n```\n./phploc.phar --log-xml=phploc.xml .\n```\n\nTo generate documentation use phar file from https://github.com/theseer/phpdox\n\n```\n./phpdox.phar\n```\n\n## Issues\n\nIf you have problems, please create a [Github Issue](https://github.com/filestack/filestack-php/issues).\n\n## Contributing\n\nPlease see [CONTRIBUTING.md](CONTRIBUTING.md) for details.\n\n## Credits\n\nThank you to all the [contributors](https://github.com/filestack/filestack-php/graphs/contributors).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilestack%2Ffilestack-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffilestack%2Ffilestack-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilestack%2Ffilestack-php/lists"}