Chapters
32 Chapters
|
4:16:27
|
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!
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"babdev/pagerfanta-bundle": "4.x-dev", // 4.x-dev
"doctrine/doctrine-bundle": "^2.10", // 2.12.x-dev
"doctrine/doctrine-migrations-bundle": "^3.2", // 3.4.x-dev
"doctrine/orm": "^2.16", // 2.18.x-dev
"knplabs/knp-time-bundle": "dev-main", // dev-main
"pagerfanta/doctrine-orm-adapter": "4.x-dev", // 4.x-dev
"pagerfanta/twig": "4.x-dev", // 4.x-dev
"symfony/asset": "6.4.*", // 6.4.x-dev
"symfony/asset-mapper": "6.4.*", // 6.4.x-dev
"symfony/console": "6.4.x-dev", // 6.4.x-dev
"symfony/dotenv": "6.4.x-dev", // 6.4.x-dev
"symfony/flex": "^2", // 2.x-dev
"symfony/form": "6.4.x-dev", // 6.4.x-dev
"symfony/framework-bundle": "6.4.x-dev", // 6.4.x-dev
"symfony/monolog-bundle": "^3.0", // dev-master
"symfony/runtime": "6.4.x-dev", // 6.4.x-dev
"symfony/security-csrf": "6.4.x-dev", // 6.4.x-dev
"symfony/stimulus-bundle": "2.x-dev", // 2.x-dev
"symfony/twig-bundle": "6.4.x-dev", // 6.4.x-dev
"symfony/ux-autocomplete": "2.x-dev", // 2.x-dev
"symfony/ux-live-component": "2.x-dev", // 2.x-dev
"symfony/ux-turbo": "2.x-dev", // 2.x-dev
"symfony/ux-twig-component": "2.x-dev", // 2.x-dev
"symfony/validator": "6.4.x-dev", // 6.4.x-dev
"symfony/web-link": "6.4.*", // 6.4.x-dev
"symfony/yaml": "6.4.x-dev", // 6.4.x-dev
"symfonycasts/dynamic-forms": "dev-main", // dev-main
"symfonycasts/tailwind-bundle": "dev-main", // dev-main
"tales-from-a-dev/flowbite-bundle": "dev-main", // dev-main
"twig/extra-bundle": "^2.12|^3.0", // 3.x-dev
"twig/twig": "^2.12|^3.0" // 3.x-dev
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4", // 3.6.x-dev
"phpunit/phpunit": "^9.5", // 9.6.x-dev
"symfony/browser-kit": "6.4.*", // 6.4.x-dev
"symfony/css-selector": "6.4.*", // 6.4.x-dev
"symfony/debug-bundle": "6.4.x-dev", // 6.4.x-dev
"symfony/maker-bundle": "^1.51", // dev-main
"symfony/panther": "^2.1", // v2.1.1
"symfony/phpunit-bridge": "7.1.x-dev", // 7.1.x-dev
"symfony/stopwatch": "6.4.x-dev", // 6.4.x-dev
"symfony/web-profiler-bundle": "6.4.x-dev", // 6.4.x-dev
"zenstruck/browser": "1.x-dev", // 1.x-dev
"zenstruck/foundry": "^1.36" // 1.x-dev
}
}
What JavaScript libraries does this tutorial use?
// importmap.php
return [
'app' => [
'path' => './assets/app.js',
'entrypoint' => true,
],
'js-confetti' => [
'version' => '0.11.0',
],
'@hotwired/stimulus' => [
'version' => '3.2.2',
],
'@symfony/stimulus-bundle' => [
'path' => './vendor/symfony/stimulus-bundle/assets/dist/loader.js',
],
'tom-select' => [
'version' => '2.3.1',
],
'tom-select/dist/css/tom-select.default.css' => [
'version' => '2.3.1',
'type' => 'css',
],
'@hotwired/turbo' => [
'version' => '7.3.0',
],
'stimulus-popover' => [
'version' => '6.2.0',
],
'debounce' => [
'version' => '1.2.1',
],
'turbo-view-transitions' => [
'version' => '0.3.0',
],
'stimulus-use' => [
'version' => '0.52.1',
],
'flowbite' => [
'version' => '2.2.1',
],
'@popperjs/core' => [
'version' => '2.11.8',
],
'flowbite-datepicker' => [
'version' => '1.2.6',
],
];
29 Comments
Hey !
If you want to connect to your database with PHPStorm (or other things), update your
compose.override.yamlfile and replace :with :
I hope this helps !
Cool! Thank you for sharing it @Adn-B
Hello guys, I'd like just to post here so it might help. I followed to readme but I had error trying to connect with the database. As Ryan posted in other comments execute
symfony var:export --multilineto check if DATABASE vars are exported and they werent.I'm running Windows 10 with Composer setup installed and Wamp with php versions 7.x and 8.x. I was able to solve the problem uninstalling composer. It seems as some how the default php version defined when installing composer was messingup symfony cli.
See ya, and keep up the good work.
Thanks for the hint @donwilson. I'm running Mac Sonoma on an M1 pro and had the same problem (missing DATABASE vars). For me the problem wasn't composer conflicting with the Symfony binary it was that in this project (and I believe newer docker compose projects) the compose file is named 'compose.yaml' and I think Symfony CLI hasn't caught up yet because once I changed this to docker-compose.yaml and reserved the app using 'symfony serve' the DATABASE vars were exported and everything works as expected. I hope this helps someone else on a Mac if they have this problem.
Nice catch !! I haven't noticed that change.. Thanks for adding up !
Hey @skofield!
Ah, that makes sense! The project DOES come with the newer
compose.yamlfile (formerlydocker-compose.yaml. The latestsymfonybinary does support this, but it was added only in a recent version - it was in version 5.6.2 released in late October 2023.This will probably trip up a few people - so I'm happy to have the conversation here!
Cheers!
Yes!.. with all the tooling one has to handle per project is easy to forget to check if everything is up to date, not to mention to stay up date with all the changes.
Thanks @weaverryan.
Hey @donwilson!
Thanks for posting the steps that unlocked you! And if anyone else has problems with the database connection, you can always go into
.envand change theDATABASE_URLto use sqlite. It's not as fancy as Postgres, but sqlite is great and will work awesome for the tutorial :).Cheers!
You are welcome Ryan.
Oh! That's a golden tip there, especially for newcomers. Maybe that line can be included in the Readme file?. I think it might be helpful.
Best regards.
Good idea - let me check into that :)
Hey, may you use Ai for translating the courses in french. it will be a good thing for french people. Thank you for your comitment.
Hey Abdoulaye,
Thank you for your interest in SymfonyCasts tutorials! We're thinking about adding a new translation to another language, and if we decide to do it someday - 99% that it will be French :) Unfortunately, I still don't know when or if it may happen. Thank you for your patience and understanding!
Meanwhile, I would suggest you to use Google Chrome browser... if you start a video, turn on the captions, and translate the page with Google Chrome built-in translator - it should translate the scripts below the video and even captions in the video :) I understand that Google translations are less accurate than AI one... but at least something that may help for now.
Cheers!
Hello im new here what is the best way to start the project ? running docker or install composer and php locally ? is there a link to an installation process ? thanks by adavance
Hey Yoyo,
All our courses require you to have PHP installed locally. You can use Docker for database, but PHP should be installed natively. Also, we do recommend you to install and use Symfony CLI as a web server. We also have a blog post about how to install all that on your specific OS, see: https://symfonycasts.com/blog/install-php-locally
About how to run a specific course project - first, download and unzip it, and look at the README.md files for course-specific instructions.
I hope that helps! If you still have any questions - don't hesitate to ask!
Cheers!
I have php version 8.2
but when run
symfony console doctrine:database:create --if-not-existsit is showing:
PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0". You are running 8.1.32. in last-stack/vendor/composer/platform_check.php on line 24Hey @kakhaber ,
Yeah, seems you need to refresh PHP versions in your Symfony CLI, seems it does not know about new PHP installed. Run
local:php:refresh. You can also see what versions installed in your system the Symfony CLI knows withlocal:php:list.If can't get it working via
symfony console- you can always runbin/consoledirectly which will use your defaultphpdirectly.Cheers!
Hi All,
PROB
I have an issue. Symfony is no longer loading my Docker variables.
I often run a "docker-compose up -d" followed by a "symfony server -d", and everything goes well on other courses, but this one is getting stuck.
**SOLUTION*
Best,
Amine
Hey @Amine!
This might also be fixed by upgrading your
symfonybinary. The Docker world is moving fromdocker-compose.yamltocompose.yaml(hence the change in your Symfony apps), but thesymfonybinary needed to be updated for this change... which I know happened... and I think it was only in a couple of months ago.Anyway, I hope that helps - that's my guess why your Docker variables suddenly vanished!
Cheers!
Hello,
When I try
symfony console doctrine:database:create --if-not-existsI have this error:
I opened php.ini remove the comment to install msql extension, tried to comment
but nothing changes...
I fixed the bug by uncomment
extension=pdo_mysqlandextension=pdo_pgsqlinphp.ini.Hey Alison,
I'm happy to hear you were able to fix this issue yourself! Yes, you need that PHP extension because we're using Doctrine in this project which stores data in the MySQL DB.
Btw, you only need to leave one DATABASE_URL uncommented in your .env file. If you leave both - the 2nd will always overwrite the 1st one, and it just mislead :)
Cheers!
Hi there,
I have an issue to boot the database container with Docker, I followed the Readme.md file but I encounter an error when running
symfony console doctrine:database:create. I receive the following error message:here's my .env file content:
I'm using macOS Big Sur and Docker Desktop 24.0.6
The command
composer compose -dalready created the database for me, if you skipsymfony console doctrine:database:create --if-not-existsand executesymfony console doctrine:schema:createandsymfony console doctrine:fixtures:loadyou should be able to run symfony serve without any problem.Hey Alison,
Thanks for this hint! One note: I suppose you meant
docker compose -dinstead ofcomposer compose -din the beginning? :)Also, instead of
symfony console doctrine:schema:createit might be better to runsymfony console doctrine:schema:update --forcethat will apply the difference only if schema is already partially exits but not compete.Cheers!
Hey @Padawan
That's a bit odd. I believe there's something wrong in your database service config in your
docker-compose.ymlfile. I'd start by double-checking that it is well configuredCheers!
Hi @MolloKhan,
The problem was not related to my config files but to Docker-Desktop itself. Here is the solution
Thanks for posting that! I've highlighted your comment in case it helps others. I wish we knew why a small number of users have such a problem with the Docker setup. After all... that's kind of the point of Docker: to "just work" :p.
Sorry for the unrelated comment, but where can I find this great PHPStorm theme?
Hey PapyDanone,
It's Dark theme (Darkula in legacy PhpStorm) - you can change it in the PhpStorm preferences, search for "theme" there. But also a few extra plugins like "Atom Material Design" and "Rainbow Brackets".
Cheers!
"Houston: no signs of life"
Start the conversation!