[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8303":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":22,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":34,"discoverSource":35},8303,"laravel-medialibrary","spatie\u002Flaravel-medialibrary","spatie","Associate files with Eloquent models","https:\u002F\u002Fspatie.be\u002Fdocs\u002Flaravel-medialibrary",null,"PHP",6138,1100,86,0,2,15,40.13,"MIT License",false,"main",true,[24,25,26,27,28,29,30],"eloquent","hacktoberfest","images","laravel","media","php","upload","2026-06-12 02:01:51","\u003Cdiv align=\"left\">\n    \u003Ca href=\"https:\u002F\u002Fspatie.be\u002Fopen-source?utm_source=github&utm_medium=banner&utm_campaign=laravel-medialibrary\">\n      \u003Cpicture>\n        \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"https:\u002F\u002Fspatie.be\u002Fpackages\u002Fheader\u002Flaravel-medialibrary\u002Fhtml\u002Fdark.webp\">\n        \u003Cimg alt=\"Logo for laravel-medialibrary\" src=\"https:\u002F\u002Fspatie.be\u002Fpackages\u002Fheader\u002Flaravel-medialibrary\u002Fhtml\u002Flight.webp\">\n      \u003C\u002Fpicture>\n    \u003C\u002Fa>\n\n\u003Ch1>Associate files with Eloquent models\u003C\u002Fh1>\n\n[![Latest Version](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease\u002Fspatie\u002Flaravel-medialibrary.svg?style=flat-square)](https:\u002F\u002Fgithub.com\u002Fspatie\u002Flaravel-medialibrary\u002Freleases)\n[![run-tests](https:\u002F\u002Fgithub.com\u002Fspatie\u002Flaravel-medialibrary\u002Factions\u002Fworkflows\u002Frun-tests.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fspatie\u002Flaravel-medialibrary\u002Factions\u002Fworkflows\u002Frun-tests.yml)\n[![Total Downloads](https:\u002F\u002Fimg.shields.io\u002Fpackagist\u002Fdt\u002Fspatie\u002Flaravel-medialibrary.svg?style=flat-square)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fspatie\u002Flaravel-medialibrary)\n    \n\u003C\u002Fdiv>\n\nThis package can associate all sorts of files with Eloquent models. It provides a\nsimple API to work with. To learn all about it, head over to [the extensive documentation](https:\u002F\u002Fspatie.be\u002Fdocs\u002Flaravel-medialibrary).\n\nHere are a few short examples of what you can do:\n\n```php\n$newsItem = News::find(1);\n$newsItem->addMedia($pathToFile)->toMediaCollection('images');\n```\n\nIt can handle your uploads directly:\n\n```php\n$newsItem->addMedia($request->file('image'))->toMediaCollection('images');\n```\n\nWant to store some large files on another filesystem? No problem:\n\n```php\n$newsItem->addMedia($smallFile)->toMediaCollection('downloads', 'local');\n$newsItem->addMedia($bigFile)->toMediaCollection('downloads', 's3');\n```\n\nThe storage of the files is handled by [Laravel's Filesystem](https:\u002F\u002Flaravel.com\u002Fdocs\u002Ffilesystem),\nso you can use any filesystem you like. Additionally, the package can create image manipulations\non images and pdfs that have been added in the media library.\n\nSpatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https:\u002F\u002Fspatie.be\u002Fopensource).\n\n## Support us\n\n[\u003Cimg src=\"https:\u002F\u002Fgithub-ads.s3.eu-central-1.amazonaws.com\u002Flaravel-medialibrary.jpg?t=2\" width=\"419px\" \u002F>](https:\u002F\u002Fspatie.be\u002Fgithub-ad-click\u002Flaravel-medialibrary)\n\nWe invest a lot of resources into creating [best in class open source packages](https:\u002F\u002Fspatie.be\u002Fopen-source). You can support us by [buying one of our paid products](https:\u002F\u002Fspatie.be\u002Fopen-source\u002Fsupport-us).\n\nWe highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https:\u002F\u002Fspatie.be\u002Fabout-us). We publish all received postcards on [our virtual postcard wall](https:\u002F\u002Fspatie.be\u002Fopen-source\u002Fpostcards).\n\n## Documentation\n\nYou'll find the documentation on [https:\u002F\u002Fspatie.be\u002Fdocs\u002Flaravel-medialibrary](https:\u002F\u002Fspatie.be\u002Fdocs\u002Flaravel-medialibrary\u002Fv11).\n\nFind yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving the media library? Feel free to [create an issue on GitHub](https:\u002F\u002Fgithub.com\u002Fspatie\u002Flaravel-medialibrary\u002Fissues), we'll try to address it as soon as possible.\n\nIf you've found a bug regarding security please mail [security@spatie.be](mailto:security@spatie.be) instead of using the issue tracker.\n\n## Testing\n\nYou can run the tests with:\n\n```bash\n.\u002Fvendor\u002Fbin\u002Fpest\n```\n\nYou can run the Github actions locally with [act](https:\u002F\u002Fgithub.com\u002Fnektos\u002Fact). To run the tests locally, run:\n\n```\nact -j run-tests\n```\n\nTo run tests for a specific PHP\u002FLaravel version, run:\n\n```\nact -j run-tests --matrix php:8.3 --matrix laravel:\"11.*\" --matrix dependency-version:prefer-stable \n```\n\nAvailable `matrix` options are available in the [workflow file](.github\u002Fworkflows\u002Frun-tests.yml).\n\n## Upgrading\n\nPlease see [UPGRADING](UPGRADING.md) for details.\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https:\u002F\u002Fgithub.com\u002Fspatie\u002F.github\u002Fblob\u002Fmain\u002FCONTRIBUTING.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email [security@spatie.be](mailto:security@spatie.be) instead of using the issue tracker.\n\n## Credits\n\n- [Freek Van der Herten](https:\u002F\u002Fgithub.com\u002Ffreekmurze)\n- [All Contributors](..\u002F..\u002Fcontributors)\n\nA big thank you to [Nicolas Beauvais](https:\u002F\u002Fgithub.com\u002Fnicolasbeauvais) for helping out with the issues on this repo.\n\nSpecial thanks to [Caneco](https:\u002F\u002Ftwitter.com\u002Fcaneco) for the original logo.\n\n## Alternatives\n\n- [laravel-mediable](https:\u002F\u002Fgithub.com\u002Fplank\u002Flaravel-mediable)\n- [laravel-stapler](https:\u002F\u002Fgithub.com\u002FCodeSleeve\u002Flaravel-stapler)\n- [media-manager](https:\u002F\u002Fgithub.com\u002Ftalvbansal\u002Fmedia-manager)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","spatie\u002Flaravel-medialibrary 是一个用于将文件与 Eloquent 模型关联的 Laravel 包。其核心功能包括通过简单的 API 将各种类型的文件（如图片、文档等）与数据库模型关联，并支持直接处理上传操作，还可以根据需要将文件存储在不同的文件系统中（例如本地或 S3）。此外，该包还提供了对已添加到媒体库中的图片和 PDF 文件进行处理的功能。适用于需要在 Laravel 应用中管理用户上传文件的场景，如新闻网站上的文章配图、在线商城的产品图片等。","2026-06-11 03:17:16","top_language"]