{"id":18386039,"url":"https://github.com/catlabinteractive/central-storage-client","last_synced_at":"2025-09-10T20:40:36.366Z","repository":{"id":37412571,"uuid":"220208632","full_name":"CatLabInteractive/central-storage-client","owner":"CatLabInteractive","description":"PHP client for central-storage.","archived":false,"fork":false,"pushed_at":"2022-10-27T12:50:33.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T11:17:37.127Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/CatLabInteractive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-07T10:18:41.000Z","updated_at":"2022-06-21T07:37:18.000Z","dependencies_parsed_at":"2022-08-18T18:40:52.995Z","dependency_job_id":null,"html_url":"https://github.com/CatLabInteractive/central-storage-client","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatLabInteractive%2Fcentral-storage-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatLabInteractive%2Fcentral-storage-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatLabInteractive%2Fcentral-storage-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatLabInteractive%2Fcentral-storage-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CatLabInteractive","download_url":"https://codeload.github.com/CatLabInteractive/central-storage-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505938,"owners_count":21115354,"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-11-06T01:20:00.727Z","updated_at":"2025-04-12T01:44:27.145Z","avatar_url":"https://github.com/CatLabInteractive.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Central Storage Laravel Client\n\nCentral Storage is a storage engine built in Laravel. It includes duplicate upload detection, supports on the fly image\n(but cached) image resize and allows you to set 'Processors' that handle more complex file transformations like video\ntranscoding etc.\n\n## Setup\nPlease follow the setup instructions described in the\n[central storage project page](https://github.com/catlabinteractive/central-storage) to setup to storage system. \nOnce that has been setup, you can include this library in your project to start storing assets.\n\n## Setting up your client project (in Laravel)\nCentral Storage provides a standard REST API and is thus consumable by any language or framework. We will focus on the\nexisting Laravel client here. Note that it is a trivial task to implement a new client, as there is only a few methods\nto implement.\n\nIn your Laravel project, run\n```composer require catlabinteractive/central-storage-client```\n\nThen, wherever you want to upload a file, initialize the client:\n\n```php\n$centralStorageClient = new CentralStorageClient(\n    'https://your-central-storage-url.com',\n    'your_key',\n    'your_secret',\n    'cdn_frontend_url' // (optional)\n);\n```\n\nOr, if you like, you can use the provider that uses the default configuration files:\n```php\n    'providers' =\u003e [\n    \n        [...]\n        \n        CatLab\\CentralStorage\\Client\\CentralStorageServiceProvider::class,\n    \n    ],\n    \n    'aliases' =\u003e [\n    \n        [...]\n        \n        'CentralStorage' =\u003e CatLab\\CentralStorage\\Client\\CentralStorageClientFacade::class,\n    \n    ]\n]\n```\n\nThe PHP client consumes Symfony's File objects. That means you can upload files straight from Laravel. The client returns\nan Eloquent model 'Asset', which can be saved directly to a database (migration file is available in `central-storage-client/database`).\n\n```php\n\u003c?php\n\nuse App\\Models\\Attachments\\Asset;\nuse Illuminate\\Http\\Request;\n\nclass AssetController\n{\n    /**\n     * @param Request $request\n     * @return \\Illuminate\\Http\\JsonResponse\n     */\n    public function upload(Request $request)\n    {\n        $file = $request-\u003efile()-\u003efirst();\n        if (!$file) {\n            abort(400, 'Please provide a valid file.');\n        }\n\n        if (!$file-\u003eisValid()) {\n            abort(400, 'File not valid: ' . $file-\u003egetErrorMessage());\n        }\n\n        /** @var Asset $asset */\n        $asset = \\CentralStorage::store($file);\n        $asset-\u003esave();\n\n        return response()-\u003ejson($asset-\u003egetData());\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatlabinteractive%2Fcentral-storage-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatlabinteractive%2Fcentral-storage-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatlabinteractive%2Fcentral-storage-client/lists"}