Chapters
37 Chapters
|
3:43:31
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!
Subscribe to download the code!
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"api-platform/core": "^3.0", // v3.1.2
"doctrine/annotations": "^2.0", // 2.0.1
"doctrine/doctrine-bundle": "^2.8", // 2.8.3
"doctrine/doctrine-migrations-bundle": "^3.2", // 3.2.2
"doctrine/orm": "^2.14", // 2.14.1
"nelmio/cors-bundle": "^2.2", // 2.2.0
"nesbot/carbon": "^2.64", // 2.66.0
"phpdocumentor/reflection-docblock": "^5.3", // 5.3.0
"phpstan/phpdoc-parser": "^1.15", // 1.16.1
"symfony/asset": "6.2.*", // v6.2.5
"symfony/console": "6.2.*", // v6.2.5
"symfony/dotenv": "6.2.*", // v6.2.5
"symfony/expression-language": "6.2.*", // v6.2.5
"symfony/flex": "^2", // v2.2.4
"symfony/framework-bundle": "6.2.*", // v6.2.5
"symfony/property-access": "6.2.*", // v6.2.5
"symfony/property-info": "6.2.*", // v6.2.5
"symfony/runtime": "6.2.*", // v6.2.5
"symfony/security-bundle": "6.2.*", // v6.2.6
"symfony/serializer": "6.2.*", // v6.2.5
"symfony/twig-bundle": "6.2.*", // v6.2.5
"symfony/ux-react": "^2.6", // v2.7.1
"symfony/ux-vue": "^2.7", // v2.7.1
"symfony/validator": "6.2.*", // v6.2.5
"symfony/webpack-encore-bundle": "^1.16", // v1.16.1
"symfony/yaml": "6.2.*" // v6.2.5
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4", // 3.4.2
"mtdowling/jmespath.php": "^2.6", // 2.6.1
"phpunit/phpunit": "^9.5", // 9.6.3
"symfony/browser-kit": "6.2.*", // v6.2.5
"symfony/css-selector": "6.2.*", // v6.2.5
"symfony/debug-bundle": "6.2.*", // v6.2.5
"symfony/maker-bundle": "^1.48", // v1.48.0
"symfony/monolog-bundle": "^3.0", // v3.8.0
"symfony/phpunit-bridge": "^6.2", // v6.2.5
"symfony/stopwatch": "6.2.*", // v6.2.5
"symfony/web-profiler-bundle": "6.2.*", // v6.2.5
"zenstruck/browser": "^1.2", // v1.2.0
"zenstruck/foundry": "^1.26" // v1.28.0
}
}
4 Comments
Hi mate, I have a project created with symfony 6 and easy admin 4, currently I'm migrating from a "conventional" approach to an API to be used by a react frontend.
Well, my question is regarding input type files, I created a Service to upload the files into an S3 but I'm not sure about the best way to receive files in the API, can you help me to understand how can I receive this input file in the API??
The field associated with this input is a string where I stored the S3 url for the user badge.
Thanks in advance
Hey back! :)
First, I'll admit that this isn't something I've had to deal much with directly. But, I can give you some guidance :).
API Platform does have some docs on this - https://api-platform.com/docs/core/file-upload/ - though I'm not sure how much I like the solution. VichUploaderBundle is magic, so both good and bad.
Another solution, if your file sizes aren't huge, is to base64_encode the field - https://symfonycasts.com/screencast/symfony-uploads/api-uploads#pure-api-endpoint-with-json-base64-decode - that allows you to send binary data on a normal "field" in your API. Then, you'd have a state processor which decodes this to get the binary, moves it to S3, then saves the final URL. This won't work for bigger files as base64 increases the upload size. Though, really, if you are handling big files, you might need to create a system where users are uploading directly to S3 - e.g. they are able to fetch a temporary signed URL, they upload directly to it, then send info to your API when completed.
Let me know if if this helps :)
Cheers!
Hello,
i'm eager to watch the part 3 of this series, when is it scheduled?
Especially State Provider :)
cheers
Hey @Joel-L!
I'm eager to record it! I'm in the planning/outline stage now - I'd say a few weeks. I'd like to get it out ASAP - but I'm also gone for a week at the end of July. But it's not far off.
Cheers!
"Houston: no signs of life"
Start the conversation!