{"id":35140588,"url":"https://github.com/akbsit/laravel-system-file","last_synced_at":"2026-04-22T08:31:43.579Z","repository":{"id":62503511,"uuid":"465317161","full_name":"akbsit/laravel-system-file","owner":"akbsit","description":"Package for downloading laravel files.","archived":false,"fork":false,"pushed_at":"2024-04-06T11:42:49.000Z","size":38,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-30T18:17:45.277Z","etag":null,"topics":["cms","downloads","files","images","laravel","media","upload"],"latest_commit_sha":null,"homepage":"","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/akbsit.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-03-02T13:28:22.000Z","updated_at":"2025-05-29T21:17:04.000Z","dependencies_parsed_at":"2023-09-16T17:57:21.793Z","dependency_job_id":"2d353855-c83f-40dd-87a6-b346e7c5698e","html_url":"https://github.com/akbsit/laravel-system-file","commit_stats":null,"previous_names":["akbsit/laravel-system-file"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/akbsit/laravel-system-file","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akbsit%2Flaravel-system-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akbsit%2Flaravel-system-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akbsit%2Flaravel-system-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akbsit%2Flaravel-system-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akbsit","download_url":"https://codeload.github.com/akbsit/laravel-system-file/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akbsit%2Flaravel-system-file/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32127844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T07:37:52.372Z","status":"ssl_error","status_checked_at":"2026-04-22T07:37:51.635Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cms","downloads","files","images","laravel","media","upload"],"created_at":"2025-12-28T11:09:20.467Z","updated_at":"2026-04-22T08:31:43.574Z","avatar_url":"https://github.com/akbsit.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# laravel-system-file, [Packagist](https://packagist.org/packages/akbsit/laravel-system-file)\n\n## Install\n\nTo install package, you need run command:\n\n```bash\ncomposer require akbsit/laravel-system-file\n```\n\nNext install migrations:\n\n```bash\nphp artisan migrate\n```\n\n## Usage\n\nTo connect package to the model, you need to add a trait `InteractsMedia`:\n\n```php\nuse Akbsit\\SystemFile\\Traits\\InteractsMedia;\nuse Illuminate\\Database\\Eloquent\\Model;\n\nclass User extends Model\n{\n    use InteractsMedia;\n}\n```\n\n## Examples\n\n1. Upload image:\n\n```php\nUser::first()\n    -\u003eaddMedia('\u003cfile_url\u003e')\n    -\u003esetFileName('user1')\n    -\u003eput();\n```\n\n2. Attach one file to the model (the old one will be overwritten when re-uploading):\n\n```php\nUser::first()\n    -\u003eaddMedia('\u003cfile_url\u003e')\n    -\u003esetFileName('user1')\n    -\u003esingle()\n    -\u003eput();\n```\n\n3. Get first image:\n\n```php\n$oSystemFile = User::first()-\u003egetMediaFirst();\n```\n\n4. Get images list:\n\n```php\n$oSystemFileList = User::first()-\u003egetMedia();\n```\n\n## Methods and properties\n\n* `media` - list of files attached to the model;\n* `addMedia($file)` - attach file to the model:\n    * `$file` - object/link of the uploaded file.\n* `mediaExists(string $sCollection)` - check for attached files (by default `default`);\n* `getMedia(string $sCollection)` - list of collection files (by default `default`);\n* `getMediaFirst(string $sCollection)` - first element of the collection (by default `default`).\n\n#### media\n\n* `getUrl()` - absolute file path;\n* `getPath()` - path to the file;\n* `getWidthAndHeight()` - get file sizes (for images);\n* `getWidth()` - get width (for images);\n* `getHeight()` - get height (for pictures);\n* `fileExists()` - check for the presence of the file physically.\n\n#### addMedia\n\n* `setFile($file)` - set object/link to a file;\n* `setModel(Model $oModel)` - set model;\n* `enablePartition()` - enable folder generation (example: `73c/d53/dce`);\n* `single()` - add one file to the model (all others are deleted if they were previously attached);\n* `setOriginFileName(string $sOriginFileName)` - set origin file name;\n* `setFileName(string $sFileName)` - set file name;\n* `setProperties(array $arProperties)` - set file properties;\n* `toDisk(string $sDisk)` - set storage disk (by default `public`);\n* `toCollection(string $sCollection)` - set collection (by default `default`);\n* `toDir(string $sDir)` - set storage folder (by default `default`);\n* `put()` - save file.\n\n## Console commands\n\n#### File synchronization\n\n```bash\nphp artisan system-file:sync\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakbsit%2Flaravel-system-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakbsit%2Flaravel-system-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakbsit%2Flaravel-system-file/lists"}