Chapters
21 Chapters
|
1:22:39
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!Compatible PHP versions: >=5.5.9
Subscribe to download the code!Compatible PHP versions: >=5.5.9
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
01.
The All-Important User Class
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": ">=5.5.9",
"symfony/symfony": "3.1.*", // v3.1.4
"doctrine/orm": "^2.5", // v2.7.2
"doctrine/doctrine-bundle": "^1.6", // 1.6.4
"doctrine/doctrine-cache-bundle": "^1.2", // 1.3.0
"symfony/swiftmailer-bundle": "^2.3", // v2.3.11
"symfony/monolog-bundle": "^2.8", // 2.11.1
"symfony/polyfill-apcu": "^1.0", // v1.2.0
"sensio/distribution-bundle": "^5.0", // v5.0.22
"sensio/framework-extra-bundle": "^3.0.2", // v3.0.16
"incenteev/composer-parameter-handler": "^2.0", // v2.1.2
"composer/package-versions-deprecated": "^1.11", // 1.11.99
"knplabs/knp-markdown-bundle": "^1.4", // 1.4.2
"doctrine/doctrine-migrations-bundle": "^1.1" // 1.1.1
},
"require-dev": {
"sensio/generator-bundle": "^3.0", // v3.0.7
"symfony/phpunit-bridge": "^3.0", // v3.1.3
"nelmio/alice": "^2.1", // 2.1.4
"doctrine/doctrine-fixtures-bundle": "^2.3" // 2.3.0
}
}
18 Comments
Hello again, and thank you very much for your tutorials.
I followed this authentication system and I got an error I can't solve. If I update my roles or the roles from another user and I don't logout and log in again the app get crazy remembering somehow the old roles. I leave the link from stackoverflow here.
https://stackoverflow.com/q...
Thank you very much for advance.
Hey Apr
Nice question! I had to do some research ;)
Look's like that's a feature that haven't been finished yet https://github.com/symfony/...
but there is a workaround - manually refreshing the user-token via subscriber. For more details about how the code looks like check this thread https://github.com/symfony/...
Cheers!
Just curious what software you use to make such great animations lika at the beginning of this video?
Yo Terry! We do this right inside Screenflow, our screen-recording/video-editing software. The magic is mostly worked by Leanna - she's gotten pretty good at this stuff over the years :)
PHPStorm doesn't autogenerate the use statement for "Symfony\Component\Security\Core\Role\Role" (SF 3.3.6). In the video it seems that oh-storm is generating it while we implement all methods. Do you know why? Is this necessary?
Yo Mike P.!
The Role use statement is totally unnecessary - don't worry about it :). I believe it is added because the PHPDoc above the getRoles() method mentions it. I'm not sure why it would not generate now... but it's definitely not needed. Good eye ;)
Cheers!
Hello!
So I downloaded the course, and replaced my old code with this start code. Now I cannot get into the server... Think you can help?
Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "KnpMarkdownBundle" from namespace "Knp\Bundle\MarkdownBundle".
Did you forget a "use" statement for another namespace? in /Users/Brian/aqua_note/app/AppKernel.php:19
Stack trace:
#0 /Users/Brian/aqua_note/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(406): AppKernel->registerBundles()
#1 /Users/Brian/aqua_note/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(113): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 /Users/Brian/aqua_note/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\Component\HttpKernel\Kernel->boot()
#3 /Users/Brian/aqua_note/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(121): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /Users/Brian/Glamp in /Users/Brian/aqua_note/app/AppKernel.php on line 19
Thank you :)
Hey Brian!
I think you forgot to run
$ composer install
If that's not the case, something might went wrong when replacing old files, try deleting the current project and unzipping again the downloaded project
Cheers!
cookies? ice cream? i'm hungry.
haha that's funny ;)
Hello,
could you please help me? When I try to open downloaded files I get this error.
What should I do?
Warning: require_once(C:\xampp\www\school\vendor/composer/autoload_real.php): f
iled to open stream: No such file or directory in C:\xampp\www\school\vendor\au
oload.php on line 5
PHP Fatal error: require_once(): Failed opening required 'C:\xampp\www\school\
endor/composer/autoload_real.php' (include_path='C:\xampp\php\PEAR') in C:\xamp
\www\school\vendor\autoload.php on line 5
Fatal error: require_once(): Failed opening required 'C:\xampp\www\school\vendo
/composer/autoload_real.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\www
school\vendor\autoload.php on line 5
Hey Kasia Tychańska
I believe you forgot to run
$ composer install
Try that, and tell me what happened. Also, there is a README.txt file with more installation instructions
Cheers!
Hello
Please, explain me.
When I use cmd I write for example
php bin/console server:run
In your course write
./bin/console server:run
Why such difference?
Why your don't need write php forward bin/console server:run
May be, I need to read something to understand this?
Hey Nina,
Actually, it's the same... but there's a subtle difference. The more expanded example is:
"php ./bin/console server:run"
That's because Symfony console (which is ./bin/console) is written in PHP, i.e. you can open ./bin/console file with PhpStorm or other editor and you'll find a PHP code there. So to run PHP code we need a PHP interpreter, i.e. call php at first and then pass it a file as an argument: "php ./bin/console". But Linux based OS like Ubuntu, Mac OS, etc. allow you to skip it and execute this file directly, but to get it working you need this file has execution permissions. It means that on some OS your can skip PHP prefix and execute this command directly like just "./bin/console", but if it doesn't work and you have an error that the file can't be executed - you can always run this file through PHP interpreter like: "php ./bin/console". If you're on Windows, most probably you need to use this expanded example. Otherwise, try the short one first. If it works - great, use it! If not, just fallback to the expanded syntax. Ryan records screencasts on a Mac, that's why on the video you can often see the short example, but we try to use expanded example in our course scripts.
Cheers!
Could I give access to this file execution permissions on Windows?
When I start the built-in server I get the error:
[ERROR] This command needs the pcntl extension to run.
You can either install it or use the "server:run" command instead to run the built-in web server.
I can still start the server with "y" but I'm curious why the error appears?
Yo Jelle S.!
Great question! There are two ways to start the built-in server:
server:startandserver:run. The only difference between the two is thatserver:run"blocks" your terminal afterwards - i.e. you can't type anything in that terminal anymore until you type "ctrl+c", which kills the server. However, when you useserver:start, it starts a background process and returns your terminal to you. Later, you can runserver:stopto kill that background process. But, this little dance requires the pcntl extension :). I think when you're typing "y", it's just falling back to usingserver:runWe show
server:runonly in our tutorials because (A) it works for everyone and (B) sometimes you can forget you have a server started, then try to start one later and get an error. In other words, the behavior ofserver:runcauses less surprises :).Cheers!
Thanks, Ryan, I'll be using server:run from now on ;)
"Houston: no signs of life"
Start the conversation!