Chapters
-
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!
Installing EasyAdmin
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Well hey friends! We are in for a treat with this tutorial! It's EasyAdmin: my favorite admin generator for Symfony. It just... gives you so many features out of the box. And it looks great! This shouldn't really be a surprise because its creator is the always-impressive Javier Eguiluz.
So let's have some fun and learn how to bend EasyAdmin to our will. Because getting a lot of features for free is great... as long as we can extend it to do crazy things when we need to.
Project Setup
To squeeze the most "easy" out of EasyAdmin, you should definitely code along with me. You probably know the drill: download the course code from this page and unzip it to find a start/
directory with the same code that you see here. Check out the README.md
file for all the setup goodies. I've already done all of these steps except for two.
For the first, find your terminal and run:
yarn install
I ran this already to save time... so I'll skip to compiling my assets with:
yarn watch
You can also run:
yarn dev-server
Which can do cool things like update your CSS without refreshing.
Perfect! For the second thing, open up another tab and run:
symfony serve -d
This fires up a local web server - using the Symfony binary - at https://127.0.0.1:8000. I'll be lazy by holding Cmd
and clicking the link to pop open my browser. Say "hello" to... Cauldron Overflow! If you've been doing our Symfony 5 series, you're definitely familiar with this project. But, this is a Symfony 6 project, not Symfony 5:
{ | |
Show Lines
|
// ... lines 2 - 3 |
"require": { | |
Show Lines
|
// ... lines 5 - 15 |
"symfony/asset": "6.0.*", | |
"symfony/console": "6.0.*", | |
"symfony/dotenv": "6.0.*", | |
Show Lines
|
// ... line 19 |
"symfony/framework-bundle": "6.0.*", | |
Show Lines
|
// ... line 21 |
"symfony/runtime": "6.0.*", | |
"symfony/security-bundle": "6.0.*", | |
"symfony/stopwatch": "6.0.*", | |
"symfony/twig-bundle": "6.0.*", | |
Show Lines
|
// ... line 26 |
"symfony/yaml": "6.0.*", | |
Show Lines
|
// ... lines 28 - 29 |
}, | |
"require-dev": { | |
Show Lines
|
// ... line 32 |
"symfony/debug-bundle": "6.0.*", | |
Show Lines
|
// ... line 34 |
"symfony/var-dumper": "6.0.*", | |
"symfony/web-profiler-bundle": "6.0.*", | |
Show Lines
|
// ... line 37 |
}, | |
Show Lines
|
// ... lines 39 - 98 |
} |
Oooo. If you are using Symfony 5, don't worry: very little will be different.
You don't need to worry too much about the majority of the code inside the project. The most important thing is probably our src/Entity/
directory. Our site has questions, and each Question
has a number of answers. Each Question
belongs to a single Topic
... and then we have a User
entity.
Our goal in this tutorial is to create a rich admin section that allows our admin users to manage all of this data.
Installing EasyAdmin
So let's get EasyAdmin installed! Find your terminal and run:
composer require admin
This is a Flex alias for easycorp/easyadmin-bundle
. Notice that it downloads the shiny new version 4 of EasyAdmin, which only works with Symfony 6. So if you're using Symfony 5, run:
composer require admin:^3
to get version 3. Right now, version 4 and version 3 are identical, so you won't notice any differences. But going forward, new features will only be added to version 4.
Cool! Now that this is installed, what's next? Ship it!? Well, before we start deploying and celebrating our success... if we want to actually see something on our site, we're going to need a dashboard. Let's generate that next!
56 Comments
If you're on the Symfony 6 track and feel like you're missing a course somewhere, you are. It's this one: https://symfonycasts.com/screencast/symfony-security
Highly recommend you do that course first, before this one, even if it is for Symfony 5. That course covers setting up users, and logins, and many of the things that are just "suddenly there" when this course starts.
Hey Ryan,
Yeah, you're right, it's good to know about Symfony Security system before starting EasyAdmin course because we're talking about it there supposing you're already familiar with it.
Cheers!
Hi
I notice that Easy Admin has been updated since you did this tutorial, there is now no html.twig files and therefore no start point for creating the admin page which quite frankly makes it very difficult to proceed as it offers you 3 options that at this time mean very little therefore making it impossible to proceed further. Can you make this available for the tutorial please as it really confuses the whole start process.
Cheers
Rob
EasyAdmin 4 requires PHP 8.0.2 or higher and Symfony 5.4 or higher. Why did you say that it only for Symfony 6?
Hey Andrzej S.
I'm afraid there was a confusion. This tutorial uses Symfony 6 and PHP 8 but it doesn't mean that you can only run EasyAdmin on those versions. EasyAdmin comes with its own version constraints that you can check here https://github.com/EasyCorp...
I hope I managed to clarify the situation. Cheers!
Thanks for the reply, it's helpful.
By the way, I love your tutorials and I learned a lot from them.
Hi there,
I tried docker-compose up -d
as in readme and I got the error
ERROR: Version mismatch: file ./docker-compose.yaml specifies version 3.7 but extension file ./docker-compose.override.yml uses version 3.0
Fixed the docker-composer.override.yml
and it worked
Hey Rodrigo!
Sorry about that! It was fixed in https://github.com/SymfonyC... - thanks for head ups!
Cheers!
Hey @Balduin
That's odd. I just downloaded the course code and the README.md
file is there. Could you download it again?
Cheers!
Do i need yarn .. or can i use EasyAdmin instead with the new AssetMapper .. ?
Hey Rufnex,
You don't need to have Yarn because all EasyAdmin assets are precompiled and work out-of-the-box. For your personal assets - sure, you can use that new AssetMapper. I suppose you would need to include your files as plain JS / CSS files instead of Webpack entries then.
Cheers!
I played a bit and it worked. Thank you.
Hey Rufnex,
Cool, thanks for confirming it works :)
Cheers!
I'm very confused, i downloaded the project files, and the migration file is intended for mysql
//...
$this->addSql('CREATE TABLE topic (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
//...
while the docker-compose file configures a postgresql container:
version: '3.7'
services:
###> doctrine/doctrine-bundle ###
database:
image: postgres:${POSTGRES_VERSION:-13}-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB:-app}
# You should definitely change the password in production
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ChangeMe}
POSTGRES_USER: ${POSTGRES_USER:-symfony}
volumes:
- db-data:/var/lib/postgresql/data:rw
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/db/data:/var/lib/postgresql/data:rw
###< doctrine/doctrine-bundle ###
volumes:
###> doctrine/doctrine-bundle ###
db-data:
###< doctrine/doctrine-bundle ###
Should we use mysql or postgresql, or am i missing something?
Hey @ling
We are sorry for the inconvenience. Yeah, we are using MySQL server for this course, and this docker-compose.yaml
is the default part of the Doctrine recipe which was installed.
I registered your issue in our internal issue tracker and we will improve it.
Thank you for the reporting! Cheers and happy coding!
I have an issue on installing the project.
When I run composer install
, I get this error:
$ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- laminas/laminas-code is locked to version 4.5.1 and an update of this package was not requested.
- laminas/laminas-code 4.5.1 requires php >=7.4, <8.2 -> your php version (8.2.0) does not satisfy that requirement.
Problem 2
- laminas/laminas-code 4.5.1 requires php >=7.4, <8.2 -> your php version (8.2.0) does not satisfy that requirement.
- friendsofphp/proxy-manager-lts v1.0.5 requires laminas/laminas-code ~3.4.1|^4.0 -> satisfiable by laminas/laminas-code[4.5.1].
- friendsofphp/proxy-manager-lts is locked to version v1.0.5 and an update of this package was not requested.
When I run **composer update**, I get this error:
**$ composer update**
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Restricting packages listed in "symfony/symfony" to "6.0.*"
Updating dependencies
Lock file operations: 1 install, 80 updates, 3 removals
- Removing friendsofphp/proxy-manager-lts (v1.0.5)
- Removing laminas/laminas-code (4.5.1)
- Removing symfony/polyfill-php73 (v1.24.0)
- Upgrading behat/transliterator (v1.3.0 => v1.5.0)
- Upgrading composer/package-versions-deprecated (1.11.99.4 => 1.11.99.5)
- Upgrading doctrine/annotations (1.13.2 => 2.0.1)
- Upgrading doctrine/cache (2.1.1 => 2.2.0)
- Upgrading doctrine/collections (1.6.8 => 2.1.2)
- Upgrading doctrine/common (3.2.1 => 3.4.3)
- Upgrading doctrine/data-fixtures (1.5.1 => 1.6.3)
- Upgrading doctrine/dbal (3.2.1 => 3.6.1)
- Upgrading doctrine/deprecations (v0.5.3 => v1.0.0)
- Upgrading doctrine/doctrine-bundle (2.5.5 => 2.9.0)
- Upgrading doctrine/doctrine-fixtures-bundle (3.4.1 => 3.4.2)
- Upgrading doctrine/doctrine-migrations-bundle (3.2.1 => 3.2.2)
- Upgrading doctrine/event-manager (1.1.1 => 2.0.0)
- Upgrading doctrine/inflector (2.0.4 => 2.0.6)
- Upgrading doctrine/instantiator (1.4.0 => 1.5.0)
- Upgrading doctrine/lexer (1.2.1 => 2.1.0)
- Upgrading doctrine/migrations (3.3.2 => 3.6.0)
- Upgrading doctrine/orm (2.10.4 => 2.14.1)
- Upgrading doctrine/persistence (2.3.0 => 3.1.4)
- Upgrading doctrine/sql-formatter (1.1.2 => 1.1.3)
- Upgrading fakerphp/faker (v1.17.0 => v1.21.0)
- Upgrading gedmo/doctrine-extensions (v3.4.0 => v3.11.1)
- Upgrading knplabs/knp-time-bundle (1.17.0 => v1.20.0)
- Upgrading monolog/monolog (2.3.5 => 2.9.1)
- Upgrading nikic/php-parser (v4.13.2 => v4.15.4)
- Upgrading sensio/framework-extra-bundle (v6.2.5 => v6.2.10)
- Upgrading stof/doctrine-extensions-bundle (v1.7.0 => v1.7.1)
- Upgrading symfony/asset (v6.0.1 => v6.0.19)
- Upgrading symfony/cache (v6.0.2 => v6.0.19)
- Upgrading symfony/cache-contracts (v3.0.0 => v3.2.1)
- Upgrading symfony/config (v6.0.2 => v6.0.19)
- Upgrading symfony/console (v6.0.2 => v6.0.19)
- Upgrading symfony/debug-bundle (v6.0.2 => v6.0.19)
- Upgrading symfony/dependency-injection (v6.0.2 => v6.0.20)
- Upgrading symfony/deprecation-contracts (v3.0.0 => v3.2.1)
- Upgrading symfony/doctrine-bridge (v6.0.2 => v6.0.19)
- Upgrading symfony/dotenv (v6.0.2 => v6.0.19)
- Upgrading symfony/error-handler (v6.0.2 => v6.0.19)
- Upgrading symfony/event-dispatcher (v6.0.2 => v6.0.19)
- Upgrading symfony/event-dispatcher-contracts (v3.0.0 => v3.2.1)
- Upgrading symfony/filesystem (v6.0.0 => v6.0.19)
- Upgrading symfony/finder (v6.0.2 => v6.0.19)
- Upgrading symfony/flex (v2.0.1 => v2.2.5)
- Upgrading symfony/framework-bundle (v6.0.2 => v6.0.19)
- Upgrading symfony/http-foundation (v6.0.2 => v6.0.20)
- Upgrading symfony/http-kernel (v6.0.2 => v6.0.20)
- Upgrading symfony/maker-bundle (v1.36.4 => v1.48.0)
- Upgrading symfony/monolog-bridge (v6.0.1 => v6.0.19)
- Upgrading symfony/monolog-bundle (v3.7.1 => v3.8.0)
- Upgrading symfony/password-hasher (v6.0.2 => v6.0.19)
- Upgrading symfony/polyfill-intl-grapheme (v1.24.0 => v1.27.0)
- Upgrading symfony/polyfill-intl-normalizer (v1.24.0 => v1.27.0)
- Upgrading symfony/polyfill-mbstring (v1.24.0 => v1.27.0)
- Upgrading symfony/polyfill-php80 (v1.24.0 => v1.27.0)
- Upgrading symfony/polyfill-php81 (v1.24.0 => v1.27.0)
- Upgrading symfony/property-access (v6.0.2 => v6.0.19)
- Upgrading symfony/property-info (v6.0.2 => v6.0.19)
- Upgrading symfony/routing (v6.0.1 => v6.0.19)
- Upgrading symfony/runtime (v6.0.0 => v6.0.19)
- Upgrading symfony/security-bundle (v6.0.2 => v6.0.20)
- Upgrading symfony/security-core (v6.0.2 => v6.0.19)
- Upgrading symfony/security-csrf (v6.0.1 => v6.0.19)
- Upgrading symfony/security-http (v6.0.2 => v6.0.20)
- Upgrading symfony/service-contracts (v3.0.0 => v3.2.1)
- Upgrading symfony/stopwatch (v6.0.0 => v6.0.19)
- Upgrading symfony/string (v6.0.2 => v6.0.19)
- Locking symfony/templating (v6.0.19)
- Upgrading symfony/translation (v6.0.2 => v6.0.19)
- Upgrading symfony/translation-contracts (v3.0.0 => v3.2.1)
- Upgrading symfony/twig-bridge (v6.0.2 => v6.0.19)
- Upgrading symfony/twig-bundle (v6.0.1 => v6.0.19)
- Upgrading symfony/var-dumper (v6.0.2 => v6.0.19)
- Upgrading symfony/var-exporter (v6.0.0 => v6.2.8)
- Upgrading symfony/web-profiler-bundle (v6.0.2 => v6.0.19)
- Upgrading symfony/webpack-encore-bundle (v1.13.2 => v1.16.1)
- Upgrading symfony/yaml (v6.0.2 => v6.0.19)
- Upgrading twig/extra-bundle (v3.3.7 => v3.5.1)
- Upgrading twig/twig (v3.3.7 => v3.5.1)
- Upgrading zenstruck/assert (v1.0.0 => v1.3.0)
- Upgrading zenstruck/callback (v1.4.1 => v1.5.0)
- Upgrading zenstruck/foundry (v1.16.0 => v1.31.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Upgrading symfony/var-exporter (v6.2.7 => v6.2.8): Extracting archive
Package sensio/framework-extra-bundle is abandoned, you should avoid using it. Use Symfony instead.
Generating autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
70 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
What about running composer global require symfony/thanks && composer thanks now?
This will spread some love by sending a star to the GitHub repositories of your fellow package maintainers.
Run composer recipes at any time to see the status of your Symfony recipes.
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
!! Fatal error: Declaration of Knp\Bundle\MarkdownBundle\Helper\MarkdownHelper::getCharset() must be compatible with Symfony\Component\Templating\Helper\HelperInterface::getCharset(): string in C:\Nicolas\Symfony\Easyadmin\Easy1\vendor\knplabs\knp-markdown-bundle\Helper\MarkdownHelper.php on line 53
!! PHP Fatal error: Declaration of Knp\Bundle\MarkdownBundle\Helper\MarkdownHelper::getCharset() must be compatible with Symfony\Component\Templating\Helper\HelperInterface::getCharset(): string in C:\Nicolas\Symfony\Easyadmin\Easy1\vendor\knplabs\knp-markdown-bundle\Helper\MarkdownHelper.php on line 53
!! Symfony\Component\ErrorHandler\Error\FatalError^ {#1600
!! #message: "Compile Error: Declaration of Knp\Bundle\MarkdownBundle\Helper\MarkdownHelper::getCharset() must be compatible with Symfony\Component\Templating\Helper\HelperInterface::getCharset(): string"
!! #code: 0
!! #file: "C:\Nicolas\Symfony\Easyadmin\Easy1\vendor\knplabs\knp-markdown-bundle\Helper\MarkdownHelper.php"
!! #line: 53
!! -error: array:4 [
!! "type" => 64
!! "message" => "Declaration of Knp\Bundle\MarkdownBundle\Helper\MarkdownHelper::getCharset() must be compatible with Symfony\Component\Templating\Helper\HelperInterface::getCharset(): string"
!! "file" => "C:\Nicolas\Symfony\Easyadmin\Easy1\vendor\knplabs\knp-markdown-bundle\Helper\MarkdownHelper.php"
!! "line" => 53
!! ]
!! }
!!
Script @auto-scripts was called via post-update-cmd
Any idea?
Thanks a lot since I have tried many things but with no success.
Hi @Nicolas-M,
We are sorry that you got this issue... As a fast solution install project with composer update laminas/laminas-code
command. It should work with PHP 8.2.
Cheers and happy codding!
Thanks Sadikoff,
I started again from scratch, and ran these commands in this order:
composer update laminas/laminas-code
composer require symfony/validator
composer install
But when I run:
composer update
I still get a blocking error which is mainly:
Compile Error: Declaration of Knp\Bundle\MarkdownBundle\Helper\MarkdownHelper::getCharset() must be compatible with Symfony\Component\Templating\Helper\HelperInterface::getCharset(): string
Hereafter is the complete return:
$ composer update
Deprecation Notice: Return type of Symfony\Flex\Response::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\xampp\htdocs\Easy1\vendor\symfony\flex\src\Response.php:68
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Restricting packages listed in "symfony/symfony" to "6.0.*"
Updating dependencies
Lock file operations: 1 install, 80 updates, 3 removals
- Removing friendsofphp/proxy-manager-lts (v1.0.5)
- Removing laminas/laminas-code (4.10.0)
- Removing symfony/polyfill-php73 (v1.24.0)
- Upgrading behat/transliterator (v1.3.0 => v1.5.0)
- Upgrading composer/package-versions-deprecated (1.11.99.4 => 1.11.99.5)
- Upgrading doctrine/annotations (1.13.2 => 2.0.1)
- Upgrading doctrine/cache (2.1.1 => 2.2.0)
- Upgrading doctrine/collections (1.6.8 => 2.1.2)
- Upgrading doctrine/common (3.2.1 => 3.4.3)
- Upgrading doctrine/data-fixtures (1.5.1 => 1.6.5)
- Upgrading doctrine/dbal (3.2.1 => 3.6.1)
- Upgrading doctrine/deprecations (v0.5.3 => v1.0.0)
- Upgrading doctrine/doctrine-bundle (2.5.5 => 2.9.0)
- Upgrading doctrine/doctrine-fixtures-bundle (3.4.1 => 3.4.2)
- Upgrading doctrine/doctrine-migrations-bundle (3.2.1 => 3.2.2)
- Upgrading doctrine/event-manager (1.1.1 => 2.0.0)
- Upgrading doctrine/inflector (2.0.4 => 2.0.6)
- Upgrading doctrine/instantiator (1.4.0 => 1.5.0)
- Upgrading doctrine/lexer (1.2.1 => 2.1.0)
- Upgrading doctrine/migrations (3.3.2 => 3.6.0)
- Upgrading doctrine/orm (2.10.4 => 2.14.1)
- Upgrading doctrine/persistence (2.3.0 => 3.1.4)
- Upgrading doctrine/sql-formatter (1.1.2 => 1.1.3)
- Upgrading fakerphp/faker (v1.17.0 => v1.21.0)
- Upgrading gedmo/doctrine-extensions (v3.4.0 => v3.11.1)
- Upgrading knplabs/knp-time-bundle (1.17.0 => v1.20.0)
- Upgrading monolog/monolog (2.3.5 => 2.9.1)
- Upgrading nikic/php-parser (v4.13.2 => v4.15.4)
- Upgrading sensio/framework-extra-bundle (v6.2.5 => v6.2.10)
- Upgrading stof/doctrine-extensions-bundle (v1.7.0 => v1.7.1)
- Upgrading symfony/asset (v6.0.1 => v6.0.19)
- Upgrading symfony/cache (v6.0.2 => v6.0.19)
- Upgrading symfony/cache-contracts (v3.0.0 => v3.2.1)
- Upgrading symfony/config (v6.0.2 => v6.0.19)
- Upgrading symfony/console (v6.0.2 => v6.0.19)
- Upgrading symfony/debug-bundle (v6.0.2 => v6.0.19)
- Upgrading symfony/dependency-injection (v6.0.2 => v6.0.20)
- Upgrading symfony/deprecation-contracts (v3.0.0 => v3.2.1)
- Upgrading symfony/doctrine-bridge (v6.0.2 => v6.0.19)
- Upgrading symfony/dotenv (v6.0.2 => v6.0.19)
- Upgrading symfony/error-handler (v6.0.2 => v6.0.19)
- Upgrading symfony/event-dispatcher (v6.0.2 => v6.0.19)
- Upgrading symfony/event-dispatcher-contracts (v3.0.0 => v3.2.1)
- Upgrading symfony/filesystem (v6.0.0 => v6.0.19)
- Upgrading symfony/finder (v6.0.2 => v6.0.19)
- Upgrading symfony/flex (v2.0.1 => v2.2.5)
- Upgrading symfony/framework-bundle (v6.0.2 => v6.0.19)
- Upgrading symfony/http-foundation (v6.0.2 => v6.0.20)
- Upgrading symfony/http-kernel (v6.0.2 => v6.0.20)
- Upgrading symfony/maker-bundle (v1.36.4 => v1.48.0)
- Upgrading symfony/monolog-bridge (v6.0.1 => v6.0.19)
- Upgrading symfony/monolog-bundle (v3.7.1 => v3.8.0)
- Upgrading symfony/password-hasher (v6.0.2 => v6.0.19)
- Upgrading symfony/polyfill-intl-grapheme (v1.24.0 => v1.27.0)
- Upgrading symfony/polyfill-intl-normalizer (v1.24.0 => v1.27.0)
- Upgrading symfony/polyfill-mbstring (v1.24.0 => v1.27.0)
- Upgrading symfony/polyfill-php80 (v1.24.0 => v1.27.0)
- Upgrading symfony/polyfill-php81 (v1.24.0 => v1.27.0)
- Upgrading symfony/property-access (v6.0.2 => v6.0.19)
- Upgrading symfony/property-info (v6.0.2 => v6.0.19)
- Upgrading symfony/routing (v6.0.1 => v6.0.19)
- Upgrading symfony/runtime (v6.0.0 => v6.0.19)
- Upgrading symfony/security-bundle (v6.0.2 => v6.0.20)
- Upgrading symfony/security-core (v6.0.2 => v6.0.19)
- Upgrading symfony/security-csrf (v6.0.1 => v6.0.19)
- Upgrading symfony/security-http (v6.0.2 => v6.0.20)
- Upgrading symfony/service-contracts (v3.0.0 => v3.2.1)
- Upgrading symfony/stopwatch (v6.0.0 => v6.0.19)
- Upgrading symfony/string (v6.0.2 => v6.0.19)
- Locking symfony/templating (v6.0.19)
- Upgrading symfony/translation (v6.0.2 => v6.0.19)
- Upgrading symfony/translation-contracts (v3.0.0 => v3.2.1)
- Upgrading symfony/twig-bridge (v6.0.2 => v6.0.19)
- Upgrading symfony/twig-bundle (v6.0.1 => v6.0.19)
- Upgrading symfony/var-dumper (v6.0.2 => v6.0.19)
- Upgrading symfony/var-exporter (v6.0.0 => v6.2.8)
- Upgrading symfony/web-profiler-bundle (v6.0.2 => v6.0.19)
- Upgrading symfony/webpack-encore-bundle (v1.13.2 => v1.16.1)
- Upgrading symfony/yaml (v6.0.2 => v6.0.19)
- Upgrading twig/extra-bundle (v3.3.7 => v3.5.1)
- Upgrading twig/twig (v3.3.7 => v3.5.1)
- Upgrading zenstruck/assert (v1.0.0 => v1.3.0)
- Upgrading zenstruck/callback (v1.4.1 => v1.5.0)
- Upgrading zenstruck/foundry (v1.16.0 => v1.31.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 80 updates, 3 removals
- Removing symfony/polyfill-php73 (v1.24.0)
- Removing laminas/laminas-code (4.10.0)
- Removing friendsofphp/proxy-manager-lts (v1.0.5)
- Upgrading composer/package-versions-deprecated (1.11.99.4 => 1.11.99.5): Extracting archive
- Upgrading symfony/flex (v2.0.1 => v2.2.5): Extracting archive
- Upgrading symfony/runtime (v6.0.0 => v6.0.19): Extracting archive
- Upgrading behat/transliterator (v1.3.0 => v1.5.0): Extracting archive
- Upgrading symfony/polyfill-mbstring (v1.24.0 => v1.27.0): Extracting archive
- Upgrading symfony/deprecation-contracts (v3.0.0 => v3.2.1): Extracting archive
- Upgrading symfony/http-foundation (v6.0.2 => v6.0.20): Extracting archive
- Upgrading symfony/event-dispatcher-contracts (v3.0.0 => v3.2.1): Extracting archive
- Upgrading symfony/event-dispatcher (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/var-dumper (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/error-handler (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/http-kernel (v6.0.2 => v6.0.20): Extracting archive
- Upgrading symfony/service-contracts (v3.0.0 => v3.2.1): Extracting archive
- Upgrading doctrine/event-manager (1.1.1 => 2.0.0): Extracting archive
- Upgrading doctrine/persistence (2.3.0 => 3.1.4): Extracting archive
- Upgrading symfony/doctrine-bridge (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/polyfill-php81 (v1.24.0 => v1.27.0): Extracting archive
- Upgrading symfony/dependency-injection (v6.0.2 => v6.0.20): Extracting archive
- Upgrading symfony/polyfill-intl-normalizer (v1.24.0 => v1.27.0): Extracting archive
- Upgrading symfony/polyfill-intl-grapheme (v1.24.0 => v1.27.0): Extracting archive
- Upgrading symfony/string (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/console (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/filesystem (v6.0.0 => v6.0.19): Extracting archive
- Upgrading symfony/config (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/polyfill-php80 (v1.24.0 => v1.27.0): Extracting archive
- Upgrading doctrine/deprecations (v0.5.3 => v1.0.0): Extracting archive
- Upgrading doctrine/lexer (1.2.1 => 2.1.0): Extracting archive
- Upgrading doctrine/instantiator (1.4.0 => 1.5.0): Extracting archive
- Upgrading doctrine/inflector (2.0.4 => 2.0.6): Extracting archive
- Upgrading doctrine/cache (2.1.1 => 2.2.0): Extracting archive
- Upgrading doctrine/dbal (3.2.1 => 3.6.1): Extracting archive
- Upgrading doctrine/common (3.2.1 => 3.4.3): Extracting archive
- Upgrading doctrine/collections (1.6.8 => 2.1.2): Extracting archive
- Upgrading doctrine/orm (2.10.4 => 2.14.1): Extracting archive
- Upgrading symfony/routing (v6.0.1 => v6.0.19): Extracting archive
- Upgrading symfony/finder (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/var-exporter (v6.0.0 => v6.2.8): Extracting archive
- Upgrading symfony/cache-contracts (v3.0.0 => v3.2.1): Extracting archive
- Upgrading symfony/cache (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/framework-bundle (v6.0.2 => v6.0.19): Extracting archive
- Upgrading doctrine/sql-formatter (1.1.2 => 1.1.3): Extracting archive
- Upgrading doctrine/doctrine-bundle (2.5.5 => 2.9.0): Extracting archive
- Upgrading doctrine/data-fixtures (1.5.1 => 1.6.5): Extracting archive
- Upgrading doctrine/doctrine-fixtures-bundle (3.4.1 => 3.4.2): Extracting archive
- Upgrading symfony/stopwatch (v6.0.0 => v6.0.19): Extracting archive
- Upgrading doctrine/migrations (3.3.2 => 3.6.0): Extracting archive
- Upgrading doctrine/doctrine-migrations-bundle (3.2.1 => 3.2.2): Extracting archive
- Upgrading symfony/translation-contracts (v3.0.0 => v3.2.1): Extracting archive
- Upgrading symfony/translation (v6.0.2 => v6.0.19): Extracting archive
- Installing symfony/templating (v6.0.19): Extracting archive
- Upgrading knplabs/knp-time-bundle (1.17.0 => v1.20.0): Extracting archive
- Upgrading doctrine/annotations (1.13.2 => 2.0.1): Extracting archive
- Upgrading sensio/framework-extra-bundle (v6.2.5 => v6.2.10): Extracting archive
- Upgrading gedmo/doctrine-extensions (v3.4.0 => v3.11.1): Extracting archive
- Upgrading stof/doctrine-extensions-bundle (v1.7.0 => v1.7.1): Extracting archive
- Upgrading twig/twig (v3.3.7 => v3.5.1): Extracting archive
- Upgrading symfony/twig-bridge (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/debug-bundle (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/dotenv (v6.0.2 => v6.0.19): Extracting archive
- Upgrading nikic/php-parser (v4.13.2 => v4.15.4): Extracting archive
- Upgrading symfony/maker-bundle (v1.36.4 => v1.48.0): Extracting archive
- Upgrading monolog/monolog (2.3.5 => 2.9.1): Extracting archive
- Upgrading symfony/monolog-bridge (v6.0.1 => v6.0.19): Extracting archive
- Upgrading symfony/monolog-bundle (v3.7.1 => v3.8.0): Extracting archive
- Upgrading symfony/property-info (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/password-hasher (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/security-core (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/property-access (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/security-http (v6.0.2 => v6.0.20): Extracting archive
- Upgrading symfony/security-csrf (v6.0.1 => v6.0.19): Extracting archive
- Upgrading symfony/security-bundle (v6.0.2 => v6.0.20): Extracting archive
- Upgrading symfony/twig-bundle (v6.0.1 => v6.0.19): Extracting archive
- Upgrading symfony/web-profiler-bundle (v6.0.2 => v6.0.19): Extracting archive
- Upgrading symfony/asset (v6.0.1 => v6.0.19): Extracting archive
- Upgrading symfony/webpack-encore-bundle (v1.13.2 => v1.16.1): Extracting archive
- Upgrading symfony/yaml (v6.0.2 => v6.0.19): Extracting archive
- Upgrading twig/extra-bundle (v3.3.7 => v3.5.1): Extracting archive
- Upgrading zenstruck/callback (v1.4.1 => v1.5.0): Extracting archive
- Upgrading zenstruck/assert (v1.0.0 => v1.3.0): Extracting archive
- Upgrading fakerphp/faker (v1.17.0 => v1.21.0): Extracting archive
- Upgrading zenstruck/foundry (v1.16.0 => v1.31.0): Extracting archive
Package sensio/framework-extra-bundle is abandoned, you should avoid using it. Use Symfony instead.
Generating autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
71 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
What about running composer global require symfony/thanks && composer thanks now?
This will spread some love by sending a star to the GitHub repositories of your fellow package maintainers.
Run composer recipes at any time to see the status of your Symfony recipes.
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255**
!!**
!! Fatal error: Declaration of Knp\Bundle\MarkdownBundle\Helper\MarkdownHelper::getCharset() must be compatible with Symfony\Component\Templating\Helper\HelperInterface::getCharset(): string in C:\xampp\htdocs\Easy1\vendor\knplabs\knp-markdown-bundle\Helper\MarkdownHelper.php on line 53
!! Symfony\Component\ErrorHandler\Error\FatalError^ {#785
!! #message: "Compile Error: Declaration of Knp\Bundle\MarkdownBundle\Helper\MarkdownHelper::getCharset() must be compatible with Symfony\Component\Templating\Helper\HelperInterface::getCharset(): string"
!! #code: 0
!! #file: "C:\xampp\htdocs\Easy1\vendor\knplabs\knp-markdown-bundle\Helper\MarkdownHelper.php"
!! #line: 53
!! -error: array:4 [
!! "type" => 64
!! "message" => "Declaration of Knp\Bundle\MarkdownBundle\Helper\MarkdownHelper::getCharset() must be compatible with Symfony\Component\Templating\Helper\HelperInterface::getCharset(): string"
!! "file" => "C:\xampp\htdocs\Easy1\vendor\knplabs\knp-markdown-bundle\Helper\MarkdownHelper.php"
!! "line" => 53
!! ]
!! }
!! PHP Fatal error: Declaration of Knp\Bundle\MarkdownBundle\Helper\MarkdownHelper::getCharset() must be compatible with Symfony\Component\Templating\Helper\HelperInterface::getCharset(): string in C:\xampp\htdocs\Easy1\vendor\knplabs\knp-markdown-bundle\Helper\MarkdownHelper.php on line 53
!!
Script @auto-scripts was called via post-update-cmd
Any idea, please?
Hi Sadikoff,
Finally, I downgraded the PHP version from 8.2 to 8.0.25.
And everything is back to normal.
Cheers,
Nicolas
Hey, sorry that I was not able to answer previous message, but yeah, sometimes it's better to use PHP version course was designed, it's pretty difficult to support all PHP versions, but I will re-check this course compatibility.
Thanks for you report!
No problem - I learned a lot from digging everywhere. :-)
An exception occurred in the driver: SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 50051 failed: FATAL: password authentication failed for user "app"
What am I doing wrong? Nothing is working..
Hey @excentrist!
Sorry about the trouble! I believe this is caused by Symfony now shipping recipes with Postgres version 14 and your local machine probably already have a Docker instance using Postgres 13. I have some more info and the solution here - please let me know if it helps!
https://symfonycasts.com/screencast/symfony-doctrine/docker-compose#comment-28388
Cheers!
Sorry, where's the solution exactly? lol
Oh geez 🤦 - https://symfonycasts.com/screencast/symfony-doctrine/docker-compose#comment-28388 - here it is (also added to my original comment above). Sorry about that!
Hi, first of all thanks a million for your awesome tutorials, truly love them.
I'm running into a bit of an issue during install here and would appreciate some help.
I've just downloaded the start archive & followed the install steps (without Docker), I'm currently using PHP 8.1.4. I've tried switching back to 8.0.12 & 8.1.2 (I'm using Laragon + manually updating Windows env vars) but the same error occurs.
However whenever I launch the Symfony server, I get the following error & unfortunately I'm unable to reach http://127.0.0.1:8000 - it never loads.
<blockquote>|CRITICA| REQUES Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("Class "App\Entity\Category" does not exist")." at C:\Users\estel\Desktop\Symfony\SymfonyCasts\code-easyadminbundle\start\templates\base.html.twig line 18</blockquote>
When I go to base.html.twig :
{{ is_granted('ROLE_PREVIOUS_ADMIN') ? 'style="background-color: red !important"' }}
I've tried closing & reopening VSCode, symfony server:stop & symfony serve again, but to no avail. Any help appreciated :) TIA
Hey Estelle G.
That's a very odd error because the entity Category
does not exist in this project. Did you change something after downloading the start directory?
Try clearing your cache rm -rf var/cache
and reinstall your vendors rm -rf vendor && composer install
Oh, and if you're on Windows, try using "localhost" instead of "127.0.0.1"
Cheers!
Thanks for your reply. Well I am not sure what happened, possibly some sort of witchcraft ahah but well anyway after restarting my PC & this project today it now works perfectly fine, but thank you anyway :)
Hallo, May i ask a question please?
I got missing translation messages in easyadmin 4
`
# symfony console debug:translation en --only-missing
State Domain Id Message Preview (en) Fallback Message Preview (de)
missing time diff.empty diff.empty diff.empty
missing EasyAdminBundle label.form.empty_value label.form.empty_value label.form.empty_value
`
I tried in app/translation/messages.en.yaml:<br />label:<br />---- form:<br />-------- empty_value : abc<br />
but still got missing, how can i fix this thanks
in vendor/easycorp/easyadmin-bundle/src/Resources/translations/EasyAdminBundle.de.php
->i found 'label' => 'form.emtyp_value' => 'keine Wert'
...
Hey Luong,
Hm, sounds like a type in the message key, right? Good catch! It's a great opportunity to create a PR to the EasyAdminBundle. Are you going to do this?
Cheers!
Hi @victor yes i try work around with symfony and easyadmin, is great :). But i dont know why i still got missing messager ?_? how can overrider translation von easyadmin in 'de' order fix this missing
Hey Luong,
Here's the link to the docs that shows how to override translations from third-party bundles: https://symfony.com/doc/cur... . But if there's a typo - it's better to send a PR and fix it upstream in the bundle's repo. Then, just upgrade to a new release that will contains those changes.
I hope this helps!
Cheers!
Bonjour! May I ask a question please?
I should use CAS bundle for my app because we use SSO system. So, can i use the following bundle while I use Symfony 6 because there is no CAS bundle for Symfony6:
https://github.com/ecphp/ca...
I really appreciate your support and your hard work! ^^
Hey Lubna,
Unfortunately, I've never worked with CAS protocol before, so don't use those bundles myself. But let me give you some hints. First of all, I see that the bundle you linked https://github.com/ecphp/ca... does not support Symfony 6 yet, though there's an issue about it: https://github.com/ecphp/ca... - feel free to follow it to know when that issue is closed. Also, if you have time - feel free to help with upgrading that bundle and make it compatible with Symfony 6 and send a PR - that may have a good side effect, because even if the bundle is slow on reviewing/merging your PR - you will be able to use *your* fork in your project while PR is not merged yet.
Other options - you may want to take a look at GitHub search: https://github.com/search?o... - probably you will find that is still maintained. If no luck - you may want to use low-level tools that are used in those bundles to write the implementation yourself - take a look at composer.json file to see what libs are used behind the scene in those bundles that might help you.
Or, another option - downgrade your project to Symfony 5.4. Basically, Symfony 5.4 == 6.0, but in Symfony 6.0 just dropped all the legacy code since 5.x version. Though, it might work and you will be able to install that bundle, but keep in mind that if the bundle is dead and nobody will add Symfony 6 support there - you won't be able to upgrade to the newer version at some point.
I hope this helps!
Cheers!
Hey Lubna,
Glad to hear it was helpful for you! And sorry that I can't help more with this problem
Cheers!
Hi again!
After downgrading my app I have a problem in my auth. Could you plz take a look at my error message as below:
An exception has been thrown during the rendering of a template ("Unable to find the current firewall LogoutListener, please provide the provider key manually.").
So, I had to add a logout path under the firewalls in my security.yaml file. Right now I can login but can't logout. Please note that I use sso auth.
Have you any idea about that?
Many thanks in advance and have a nice day!
Hey Lubna,
Please, take a look at the config/packages/security.yaml configuration, in particular, at the "logout" key there. Most probably you need to specify path key manually for logout option under your firewall there.
If you do so, and don't see that error anymore - great, but what error do you see now? What happens where you logging out?
Cheers!
Hey Lubna,
Well, still something should happen :) Were you followed the /logout path in the address bar of your browser? Were you redirected somewhere then? Could you show your logout configuration in your security.yaml? Also, your logout() route you created? Does it have something "throw new \Exception('This should never be reached')" inside or something like this?
Cheers!
Hey! thanks again.
yep I can find the redirected path while chlicking (mypath/logout) and see it in the address bar. Also, I added the logout route in my defult controller.
Hey Lubna,
Hm, ok... do you have a logout entry point like this?
/**
* @Route("/logout", name="app_logout")
*/
public function logout()
{
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
}
Also, could you show your security firewall configuration?
Cheers!
Thanks again! I have the following route in my main controller:
#[Route('/logout', name: 'logout')]
public function logoutAction() {
if (($this->getParameter('cas_logout_target') !== null) && (!empty($this->getParameter('cas_logout_target')))) {
\phpCAS::logoutWithRedirectService($this->getParameter('cas_logout_target'));
} else {
\phpCAS::logout();
}
}
And here is my firewall config:
firewalls:
dev:
pattern: ^/(_(profiler|wdt|error)|css|images|js)/
security: false
l3_firewall:
pattern: ^/
security: true
cas: true # Activation du CAS
logout:
path: /logout
Hey Lubna,
Thanks for sharing more details! Hm, your config looks ok, but let's try to tweak it a bit... Could you try to rename your firewall name "l3_firewall" -> "main" in this config? Also, make sure you renamed "l3_firewall" with "main" in other parts of your application if you're referencing to it somewhere. Then, (and it's important steps next!), clear the cache, next reload your fixtures that should force logging out the current user, and finally log in again and try to logout. Still can't logout?
Cheers!
"Houston: no signs of life"
Start the conversation!
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=8.1.0",
"ext-ctype": "*",
"ext-iconv": "*",
"composer/package-versions-deprecated": "^1.11", // 1.11.99.4
"doctrine/doctrine-bundle": "^2.1", // 2.5.5
"doctrine/doctrine-migrations-bundle": "^3.0", // 3.2.1
"doctrine/orm": "^2.7", // 2.10.4
"easycorp/easyadmin-bundle": "^4.0", // v4.0.2
"handcraftedinthealps/goodby-csv": "^1.4", // 1.4.0
"knplabs/knp-markdown-bundle": "dev-symfony6", // dev-symfony6
"knplabs/knp-time-bundle": "^1.11", // 1.17.0
"sensio/framework-extra-bundle": "^6.0", // v6.2.5
"stof/doctrine-extensions-bundle": "^1.4", // v1.7.0
"symfony/asset": "6.0.*", // v6.0.1
"symfony/console": "6.0.*", // v6.0.2
"symfony/dotenv": "6.0.*", // v6.0.2
"symfony/flex": "^2.0.0", // v2.4.5
"symfony/framework-bundle": "6.0.*", // v6.0.2
"symfony/mime": "6.0.*", // v6.0.2
"symfony/monolog-bundle": "^3.0", // v3.7.1
"symfony/runtime": "6.0.*", // v6.0.0
"symfony/security-bundle": "6.0.*", // v6.0.2
"symfony/stopwatch": "6.0.*", // v6.0.0
"symfony/twig-bundle": "6.0.*", // v6.0.1
"symfony/ux-chartjs": "^2.0", // v2.0.1
"symfony/webpack-encore-bundle": "^1.7", // v1.13.2
"symfony/yaml": "6.0.*", // v6.0.2
"twig/extra-bundle": "^2.12|^3.0", // v3.3.7
"twig/twig": "^2.12|^3.0" // v3.3.7
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.3", // 3.4.1
"symfony/debug-bundle": "6.0.*", // v6.0.2
"symfony/maker-bundle": "^1.15", // v1.36.4
"symfony/var-dumper": "6.0.*", // v6.0.2
"symfony/web-profiler-bundle": "6.0.*", // v6.0.2
"zenstruck/foundry": "^1.1" // v1.16.0
}
}
Thank you! :)