{"id":15021898,"url":"https://github.com/goetas/multipartuploadbundle","last_synced_at":"2025-10-06T00:36:14.733Z","repository":{"id":45133208,"uuid":"161458159","full_name":"goetas/MultipartUploadBundle","owner":"goetas","description":"Symfony multipart/related/mixed/alternative content type handler (rfc1341).","archived":false,"fork":false,"pushed_at":"2024-02-06T15:58:22.000Z","size":97,"stargazers_count":22,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-24T01:35:40.656Z","etag":null,"topics":["http","multipart-uploads","php","symfony","symfony-bundle"],"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/goetas.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,"publiccode":null,"codemeta":null}},"created_at":"2018-12-12T08:42:33.000Z","updated_at":"2023-11-12T02:45:46.000Z","dependencies_parsed_at":"2024-02-06T17:00:03.458Z","dependency_job_id":null,"html_url":"https://github.com/goetas/MultipartUploadBundle","commit_stats":{"total_commits":63,"total_committers":8,"mean_commits":7.875,"dds":0.4444444444444444,"last_synced_commit":"0003cbb58b1abae4d8fefd1fd74a15881f7233f4"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/goetas/MultipartUploadBundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goetas%2FMultipartUploadBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goetas%2FMultipartUploadBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goetas%2FMultipartUploadBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goetas%2FMultipartUploadBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goetas","download_url":"https://codeload.github.com/goetas/MultipartUploadBundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goetas%2FMultipartUploadBundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278542660,"owners_count":26004060,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["http","multipart-uploads","php","symfony","symfony-bundle"],"created_at":"2024-09-24T19:57:11.899Z","updated_at":"2025-10-06T00:36:14.717Z","avatar_url":"https://github.com/goetas.png","language":"PHP","readme":"# GoetasMultipartUploadBundle\n\n[![Build Status](https://travis-ci.org/goetas/MultipartUploadBundle.png?branch=master)](https://travis-ci.org/goetas/MultipartUploadBundle)\n[![Latest Stable Version](https://poser.pugx.org/goetas/multipart-upload-bundle/v/stable.png)](https://packagist.org/packages/goetas/multipart-upload-bundle)\n[![Code Coverage](https://scrutinizer-ci.com/g/goetas/MultipartUploadBundle/badges/coverage.png)](https://scrutinizer-ci.com/g/goetas/MultipartUploadBundle/)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/goetas/MultipartUploadBundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/goetas/MultipartUploadBundle/?branch=master)\n\nSymfony `multipart/related`, `multipart/alternative` and `multipart/mixed` content type handler.\n\nThis bundle implements a subset of the [https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html](https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html) specifications \nand allows you to deal with `Content-Type: multipart/*;` requests with Symfony.\n\n## Install\nRun `composer require goetas/multipart-upload-bundle`\n\nAdd bundle to symfony (if not using symfony/flex)\n\n## Request format\n\nA `multipart/related` request could look like this:\n\n```\nHost: localhost\nContent-Type: multipart/related; boundary=19D523FB\n\n--19D523FB\nContent-Type: application/json\n\n{\n    \"content\": \"Some JSON content\"\n}\n--19D523FB\nContent-Type: image/png\nContent-Disposition: form-data; name=\"image\"; filename=\"image.jpg\"\nContent-MD5: 314ca078416a9b27efbe338ac5a2f727\n\n... binary content...\nContent-Type: text/html\nContent-Disposition: form-data; name=\"content\"\nContent-MD5: 314ca078416a9b27efbe338ac5a2f727\n\n\u003ca href=\"https://github.com/goetas/MultipartUploadBundle\"\u003eHTML content\u003c/a\u003e\n\n--19D523FB\nContent-Type: image/png\nContent-Disposition: attachment; filename=\"image.jpg\"\nContent-MD5: 314ca078416a9b27efbe338ac5a2f727\n\n... binary content...\n\n--19D523FB\nContent-Type: octet/stream\nX-Custom-Header: header value\n\n... binary content...\n\n--19D523FB--\n```\n\n## Usage\n### Controller\nBody will not be decoded automatically, you can decode it by yourself or use [FOSRestBundle](https://github.com/FriendsOfSymfony/FOSRestBundle) to handle it transparently \n```php\npublic function indexAction(Request $request)\n{\n    if ('application/json' == $request-\u003eheaders-\u003eget('content-type')) {\n        $data = json_decode($request-\u003egetContent(), true);\n    }\n}\n```\n\n### Form Fields\nParts with `form-data; name=` in `Content-Disposition` part's headers\nwill be treated like an regular uploaded file.\n```php\n$html = $request-\u003erequest-\u003eget('content');\n```\n\nCan be used with Symfony's form builder\n```php\n$builder-\u003eadd('content', TextAreaType::class);\n```\n\n### Uploaded Files\nParts with `form-data; name=` and `filename=` in `Content-Disposition` part's headers\nwill be treated like an regular uploaded file.\n```php\n$file = $request-\u003efiles-\u003eget('image');\n```\n\nCan be used with Symfony's form builder\n```php\n$builder-\u003eadd('image', FileType::class);\n```\n\n### Attachment Files\nParts with `attachment; filename=` in `Content-Disposition` part's headers\nwill be treated as an attachment file.\n```php\n$attachment = $request-\u003eattributes-\u003eget('attachments')[0];\n```\n\n### Related Parts\nParts without a `filename` will be treated as `Riverline\\MultiPartParser\\StreamedPart` object.\nWill be possible to access as well all the parts trough the `related-parts` attribute.\n```php\n$part = $request-\u003eattributes-\u003eget('related-parts')[0];\n```\n\n- Get part's headers\n```php\n$headers = $part-\u003egetHeaders()-\u003eall();\n```\n\n- Get part's content\n```php\n$content = $part-\u003egetContent();\n```\n\n- Get part's content as resource\n```php\n$content = stream_get_contents($part-\u003egetContent(true));\n```\n\n- First part injected\n\nBy default, when a message is `multipart/*`, the first part will become the Symfony message content.\nYou can disable this by setting `first_part_as_default` to `false`.\n```php\n$content = $request-\u003egetContent(); // content of the first part, not the whole message\n```\n\n## Configurations\n\n```yaml\ngoetas_multipart_upload:\n  first_part_as_default: true\n```\n\n## Note \n\nThe code in this project is provided under the \n[MIT](https://opensource.org/licenses/MIT) license. \nFor professional support \ncontact [goetas@gmail.com](mailto:goetas@gmail.com) \nor visit [https://www.goetas.com](https://www.goetas.com)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoetas%2Fmultipartuploadbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoetas%2Fmultipartuploadbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoetas%2Fmultipartuploadbundle/lists"}