gstreamer0.10-ffmpeg
gstreamer0.10-plugins-good
packages.
Hey guys! If you've watched even one video on KnpU - please tell me that you have - then you've seen me using PHPStorm.
Now think about how much you use your editor. If you work 40 hours a week I bet you stare deeply into your editor at least 20 of those hours. So over a year, that's... let's see here - carry the one - over 1,000 hours!
So if you could learn something that saves you a few seconds now, that's going to mean you're saving 10's of hours in the future.
Particularly in Symfony development, mastering PHPStorm is going to completely speed up the way you develop and help you catch mistakes you may have missed otherwise.
If you've never used PHPStorm before it does have a free trial period that you can use to see if it's going to work for you.
Go Deeper!
For even deeper information about PhpStorm settings and shortcuts, you can also check out Beginner's Guide to PhpStorm - Tips & Tricks.
I'm working with a fresh version of PHPStorm, this is not how I want my development environment to look - all this white is stressing me out. So download your own copy and let's customize this thing together.
If I open any of my files right now you'll see that they look pretty ugly. Let's clean that up first: open up preferences and in Appearance under Appearance & Behavior you can select your theme, change that to Darcula.
(insert Dracular slow laugh here)
This is the theme of the UI which also goes and sets the scheme for the editor. And this is already so much better. Staring into a white screen for 1,000+ hours a year is very similar to just staring at a lightbulb -- not so great on the eyes.
Speaking of eyes, I'd like to see my font size a bit bigger here. Back to preferences, on a mac its shortcut is ⌘
, so I'll start using that. On Windows and Linux, it's the longer Ctrl
+Alt
+S
- you can check out the key mappings under the keymap section, to see and simplify these.
Use this search to look for font. This pulls up a few things, general appearance, colors & fonts. Let's pick font here and there's font size.
I can't immediately change the font size I've got because that would change the Darcula scheme. So first let's click 'save as' so we can customize this, save it as 'darcula mine'. And now I can change the font size to 14 and give it a line spacing of say 1.2. Ahh so much better.
Over here on the left, you can see the tuts
and knpu
directories. I use these to help me build this tutorial - but when I'm coding, I don't want to see them. Any time you have a directory that you don't want PHPStorm to look into, or that you just don't want to see, you can hide it. Right click tuts
, find 'mark directory as' and select 'excluded'. In a second that will hide this for me. Let's also do this on the knpu
directory.
And now we can change the view in the upper left from 'project' to 'project files'. Let's also exclude this .idea
directory. If you ever need to see those in the tree again you can just switch back to 'project' and they'll reappear. Then you can even unmark them if you want to.
Okay back to the 'project files' view. So PHPStorm is the best editor I've ever seen. But the real power with Symfony comes from an amazing plugin. Back in preferences if you search for Symfony it brings you to a plugin spot. Click 'Browse Repositories', here you see the community plugins for Symfony and there's one called the 'Symfony2 Plugin'.
Tip
The "Symfony2 Plugin" was renamed to "Symfony Support" - install this instead
To prove how great it is just look at its 1.2 million downloads. So press the 'Install Plugin' button to get this added to our IDE.
The other plugin that you are definitely going to want to install is this called 'PHP Annotations'. Find that one in the search and install it. Perfect.
Close out of this window, and then press ok and restart PHPStorm.
You only need to install the Symfony plugin once, but each time you start a new project you will need to enable it. Back in preferences, search Symfony and check the 'Enable Plugin for this Project' checkbox. Do that just one time per project - not bad!
The checkbox had a note that it requires a restart, that's mostly not true. But I am going to restart one more time because there are a few small features that will not work until you do this.
Now we're really ready to go! I've already got my my site running on localhost:8000 and we've got a nice looking 404 page since there isn't anything inside of here yet.
Tip
To run the website, execute in your terminal:
php app/console server:run
And open the homepage at http://localhost:8000/
Just to prove that the Symfony Plugin is installed and running, in the bottom right of PHPStorm you should see a little Symfony menu. Clicking it gives you a quick way to jump into the profiler for any recent requests.
Now that our editor is all setup let's get down to work!
I dont know why, but the first Darculah ah ah made me laugh.
The second one made me laugh even harder...
How relevant are there? What would you advise as extra source material to get PHPStorm up to speed?
Hey Wout,
Lol! I'm glad to know you liked our "smart" jokes. I recommend you learn as many as possible shortcuts, refactorings, live templates, and also install a few PHPStorm plugins. For example, the Symfony support plugin is the best one. If you use PHPUnit, install the PHPUnit Enhancement plugin. You can also browse the Plugins store and see what other plugins might be helpful for you.
Cheers!
Hi All, trying to get PHPStorm to play nice with Symfony 5. I have a fresh install of Symfony 5 and right out of the box PHPStorm shows an error in Symfony's /src/kernel.php file stating that the "class must be declared as abstract or implement methods..." . So I ignored this since the site actually loads fine as I get the default Symfony landing page. Continuing on, I created an entity, and once again PHPStorm is drawing red underlines on almost everything. For example, PHPStorm is complaining about the code below (generated by Symfony when creating a entity) with an error "Expected { " between the : and ? . It's difficult to identify the real problems in my code when the IDE is showing so many errors for code that is actually working. It's as if PHPStorm doesn't recognize the modern PHP 7.2/Symfony syntax. I have my PHPStorm PHP settings set to appropriate PHP 7.2 version. FYI, this occurs regardless of whether "Symfony Support" plugin is enabled or not and furthermore the plugin clearly states it is only compatible with Symfony 2 and 3. Any help would be greatly appreciated as this is driving me crazy.
public function getTitle(): ?string
{
return $this->title;
}
Hey Ryan!
Ah! Trouble right out of the gate! Let's see what we can figure out :).
Hmm. Indeed PhpStorm is misbehaving badly. Let's look at a few things:
class must be declared as abstract or implement methods
The fact that your code works, but you get this error, first makes me think that PhpStorm may be seeing multiple instances of the core code in your project. This is a total guess. But if, for example, PhpStorm saw 2 core Symfony\Component\HttpKernel\Kernel
classes from 2 different Symfony installs (like if you had 2 projects open in one PhpStorm directory, or something), then it could get confused and be trying to use the same one. There's an easy way to check this: hold Cmd (or Ctrl) and click the word Kernel
on this line at the top of your Kernel.php file:
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
If you jump straight to the core file, then this is not the problem. If you get a little selector for you to choose which Kernel class to open, then it might be and you should investigate where the duplicate copy is coming from.
Expected { " between the : and ? .
I agree that this 100% sounds like PhpStorm is parsing this code as PHP 7.1 (or older) code. So, you checked the same place I would. Just to triple check, the settings should be under "Languages & Frameworks -> PHP" and then there is a selector for "PHP Language Level". There also a somewhat related screen: "Languages & Frameworks -> PHP -> Composer". If you click "Synchronize IDE Settings with composer.json", then it should read the "require.php" version from your composer.json file and use that as your PHP version. But I'm not sure this could be the cause of your problem, as I believe this checkbox is "sort of" a convenient way to set the "PHP Language Level" for you.
I'd also make sure you have the latest PhpStorm version. This behavior is, indeed, "so bad" that it feels like something is very wrong :).
Cheers!
It seems like maybe the Symfony plugin for PHPStorm isn't compatible with Symfony 5, or maybe even 4. It's hard to know, but I'm trying to get a current app skeleton going via "composer create-project symfony/website-skeleton testsite", which is what the Symfony documentation says to do, and I've activate the plugin for the PHPStorm project and the little "Symfony" menu appears in the lower right, but the additional file templates (Controller, CompilerPass, Form, etc) are never added to the "New" menu described in this tutorial, and I can't figure out why.
The filles in this tutorial are using Symfony 3.3.10. Can you advise on compatibility with 5? Will the additional chapters in this tutorial work with it? I don't want to downgrade Symfony just to work with the editor.
Hey Steven L.
The one trick I know to make Symfony plugin work a bit better is to tweak its config. Go to settings -> Languages & Frameworks -> PHP -> Symfony
and change:
Translation root path: var/cache/dev/translations
Web directory: public
It won't make the file templates to appear but I think you don't need them anymore. If you install MakerBundle on your project, you will have a command for creating boilerplate forms, entities, commands, controllers, CRUD, and much more. Give it a check: https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html
I hope it helps. Cheers!
Thanks Diego. Those might be the default settings for the plugin; at any rate, they're the current settings I have, so that's not the issue.
I just have an aversion to not knowing why something's not working; I hate when things fail silently. There has to be a reason these menus are present in other projects - like the ones from the course downloads here - but not in ones I create. :/ Even if it's not critically important on its own, it means something's not configured correctly, but I don't even know who to ask. Seems like it's an issue with the plugin creator, not PHPStorm itself? But there were only a couple of old comments on the plugin page and I don't even know if it's being actively maintained.
Hey Steven L.
Yea, I feel you... When Symfony3 was just released, I remember those features used to work on PHPStorm. I believe it's a problem related to the plugin instead of the IDE. I found this page where you can create a new issue https://github.com/Haehnche...
Cheers!
You should probably mention the following:
<br /> [Symfony\Component\Debug\Exception\ContextErrorException] <br /> Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
I was able to run "composer install" by manually specifying an older php 7.2 binary that I still had installed:
/Applications/DevDesktop/php7_2_x64/bin/php /usr/local/bin/composer install
(This is with Composer version 1.10.6)
Hey Steven L.!
That's our bad - it's something we're working on right now. Both PHP 7.3 and 7.4 caused some issues with some older dependencies of various tutorials. Basically, a tutorial works fine in 7.2 or earlier, but in 7.3 and 7.4, they break due to a bug in an old dependency. We're currently working on:
A) Upgrading some of those dependencies to avoid this
B) Or (in some cases) making the supported PHP version more transparent so that if we can't, for some reason upgrade the dependencies in a tutorial, you would at least get a proper error from Composer that tells you that the code will only work on, for example, 7.2 or lower (and we'd like to put this info right in front if you when you download the code).
So, apologies for this! Both php 7.3 (and especially 7.4) came with a few minor changes that really caused havok in some of our older tutorials. We're working to fix this systematically so that we can be aware of these issues in the future and roll out fixes across the board.
Cheers!
Thanks Ryan. The courses aren't dated in any way that I can see, other than looking for the age of the oldest comment, so it's hard to identify (as a new subscriber anyway) which courses are old. Current OSX ships with PHP 7.3.11, so having things not work with PHP 7.3 is a pretty big problem. I'm trying to bootstrap into Symfony to decide whether to migrate a Drupal 7 app forward to Drupal 8 (or really 9) or build it in Symfony since it doesn't leverage much of Drupal's core other than logins and the form API... but if things in the main development pipelines here require old versions of PHP, it's not going to work; I need some of the language features of 7.4 in the runtime environment, and it's a pain to maintain older versions of PHP to run the dev environment.
I'm sympathetic to the difficulties of keeping things up to date, but it's pretty important. If you could maybe make some documentation available very soon about the 7.3/7.4 issues, so at least your subscribers are aware of them while you work on them, it would help. I lost half a day working on this yesterday while just trying to go through the first couple of videos in this series, and while it's one way to learn, it's not my preferred way :/
Hey Steven L.!
Yea, I'm really sorry about this :(. We got hit by a small storm if issue all at once. Well, really, it was a *tiny* number of issues on PHP 7.4, but they affected *many* tutorials. So, to be honest, we're playing catch up with getting thing solved correctly. To your point about knowing which tutorials are new or old, we *almost* deployed a feature today that would show the composer.json file for all tutorials. Actually, we did deploy it, but I rolled it back temporarily because of a few UX things (sorry!). The point is, we're *very* close to much more transparency.
Overall, apart form some hiccups we're fixing (and that largely, we created), most tutorials (unless they actually say they are archived) work on any version of PHP. Actually, PHP 7.4 was the big problem which caused us to upgrade some tutorials (which we messed up on some tutorials) - most tutorials were working fine on PHP 7.3 and before (with a few exceptions on 7.3). And when they are broken, it's for a really silly (but annoying) reason - some deep dependency that has some slight code that PHP doesn't like on a new version. It's nothing that will affect learning, assuming you can get the project up and running without issues, of course :).
So, the goal is 2 things, and soon:
1) Transparency of what version of libraries are used on a tutorial
2) Guaranteeing that the downloaded code works in all PHP versions. Or, if we *do* decide to not update a tutorial to work for (for example) PHP 7.4, making it very obvious when you download the code. No tutorial at this point should *require* PHP 7.4 (that was a mistake): we're actually quite conservative with PHP versions, as we want the tutorials to work for as many people as possible.
Anyways, if you have any doubts or questions on anything, just let me know :). I've been around Symfony for a *long* time and (amazingly) around Drupal also for many years now, though I am no qualified Drupal dev, I will admit ;).
Cheers!
WARNING! This course is outdated too much. Don't use it if you don't want get problems after problems.
Hey Robertas,
This course and concepts we're covering in it are still valid. Do you have any specific problems watching this course? Could you share them with us? We would like to help you figuring them out and solving. And we would like to add some notes to the course as well if needed to help other users to avoid the problems you hit. We're maintaining our courses and trying to keep them up to date.
Or are you working on another IDE and this comment is just negative advertising to PhpStorm? :p Just kidding, of course, but it would be appreciated to hear feedback from you about specific problems you faced during this course.
Looking forward to your response!
Cheers!
Probably course not suppose to work with my version. Well I tried 3 different ways and couldn't make Controller to work. I got upset and surrendered, sorry about meaningless message.
Hey Robertas,
No problem! Let me try to help you figuring out the problem, with exact error message it's now easier to understand what's going on ;)
Cheers!
I got this problem when I try lauch course files on "symfony server:start"
arning: require(C:\Users\Robert\PhpstormProjects\PhpStorm\app/../vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\Robert\PhpstormProjects\PhpStorm\app\autoload.php on line 7
Fatal error: require(): Failed opening required 'C:\Users\Robert\PhpstormProjects\PhpStorm\app/../vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\Users\Robert\PhpstormProjects\PhpStorm\app\autoload.php on line 7
Hey Robertas,
So, yeah, thanks to the error message now I could say you didn't execute "composer install" in your project... sounds like you don't have vendors, i.e. vendor/ folder in your project root directory. Did you download the course code from SymfonyCasts? Are you in start/ directory? In both start/ and finish/ directories of downloaded source code you will find README.md file that contains some steps to bootstrap the project. One of those steps should be go to the project root folder in your terminal tab and run "composer install" command. Keep in mind that you also need to have Composer installed globally in your system. You can do it by following the instructions on official website: https://getcomposer.org/dow... if you haven't done this yet.
So, this error looks totally unrelated to PhpStorm at all, but I understand that it's a huge blocker for you to be able to move forward. So, let's fix it!
Let me know if it helps to get rid of this error message.
Cheers!
FYI, start/README.md doesn't have any bootstrap instructions or mention running "composer install". It just says:
Lean and Mean Dev with PhpStorm (for Symfony)
Hiya!
This is the code, script and other Tom-foolery for the tutorial that you can find here:
http://knpuniversity.com/sc...
Cheers!
Hey Steven L.!
Ah! You're right! Shame on me. This is a bit of an older tutorial, and apparently I forgot to correctly add the README :/. We will get that updated!
Thanks!
Hey Robertas,
No problem! Please, let us know if it does not help and we will continue fixing it together.
Cheers!
When I symfony server:start, I get "WARNING unable to find the application log"
also some errors in 127.0.0.1:8000
FileLoaderLoadException in FileLoader.php line 133:
The file "parameters.yml" does not exist (in: C:\Users\Robert\PhpstormProjects\start\app/config) in parameters.yml (which is being imported from "C:\Users\Robert\PhpstormProjects\start\app/config\config.yml").
InvalidArgumentException in FileLocator.php line 69:
The file "parameters.yml" does not exist (in: C:\Users\Robert\PhpstormProjects\start\app/config).
Hey Robertas Š.!
The "WARNING unable to find the application log" warning is ok - I sometimes get this too - it just happens if you start your web server but haven't loaded any pages yet. In that situation, Symfony hasn't created any log files yet, so the server doesn't see it. No big deal.
The other error is a bigger deal :). By the way, are you coding through this tutorial as a way to learn more about PhpStorm? Or some different reason? I ask because the code behind this tutorial now uses an older version of Symfony. If you're trying to learn Symfony itself, I would point you somewhere else. But if you want to get the code for this tutorial working so you can try what we're trying, we can definitely help with that!
The overall problem is that - because this tutorial is a little old - it looks like we didn't include very good instructions for setting it up! Gasp! That's our bad! Usually, when you download a course code and unzip it, inside the "start/" directory, you will find a README.md file with all the setup details. In this case, that file exists, but doesn't contain anything useful. Sorry about that :/. Here are the setup steps:
1) Download the course code, unzip it, and find the "start/" directory
2) Inside the start/
directory, run: composer install
(it looks like you've already done that!)
3) Typically, when you finish the previous command, some interactive prompt will ask you questions about your database configuration and other things. That information is used to create that missing app/config/parameters.yml
file. It looks like that didn't happen for you, for some reason. But, that's not really a big deal. Instead, copy app/config/parameters.yml.dist
to app/config/parameters.yml
. Then, open that file and customize the database connection information to something that will work on your machine.
4) Then, initialize the database by running:
php app/console doctrine:database:create
5) Finally, run symfony server:start
and go to http://localhost:8000 in your browser.
Please let me know if that helps! Sorry for the missing details :).
Cheers!
Oh hey weaverryan
Probably I chose wrong to start Symfony from here. Please point the way for starting with Symfony.
Hey Robertas Š.
Yeah, this tutorial is about PHPStorm mostly, so you won't learn about Symfony. Our introduction tutorial to Symfony4 is this one https://symfonycasts.com/sc...
after that, you can follow this track: https://symfonycasts.com/tr...
and when you finish with that, you can see what's new in Symfony5 and how to upgrade from Symfony4: https://symfonycasts.com/sc...
We will deliver more content focused on Symfony5 but the reality is that Symfony didn't change too much from 4 to 5
Cheers!
Hi, I have this error on Event Log
Plugin Error
Problems found loading plugins:
Plugin "Symfony Plugin" was not loaded: required plugin "de.espend.idea.php.annotation" not installed.
Disable Symfony Plugin
Open plugin manager
Hi Soltan
You should install and activate PHP Annotations
plugin. You can re-check video, there is information about this plugin.
Cheers!
I got it.I created a new composer project.But which package to choose from to get the file directory structure as above?
Hey Priya,
What do you mean about the same file directory structure as above? If you're talking about our project, i.e. you want to code along with us, you need to download the course code, see "Download" -> "Course Code" in the right top corner on any video page, then, unpack the downloaded archive and open the start/ directory in your PhpStorm. Actually, we show it Please, notice that download features are available for users with paid subscription or course owners.
Cheers!
Hi,
I'm lost.When I open the phpstorm,I do see to create new php empty project,new phpstorm workshop project,which one should I need to choose
just mess up your eyes bro! (you shouldn't recommend users inferior themes just because they look "cool"). and eveyrone else who cares about their eye health look into solarized light theme (there's also solarized dark, but yea, dont use that)
Hey wqdqwd!
Ah, you're totally right! It looks like if you want to reduce eye strain, the solarized are the way to go. I didn't mean to make a bad recommendation - I just love the Darcula theme (still use it to this day).
Cheers!
Hello,
I'm having a problem with Excluded folders view in Project tool window - they're not shown. Neither in Project scope, nor in Project Files scope. In your screencast the excluded folders are marked red in the Project scope. In mine PhpStorm they're not visible at all. I'm using PhpStorm 7.1.5. Can it be the feature is not present in my version?
Btw, when I go to Settings / Directories, the excluded folders are listed along with the nice red folder icon. Also, directories marked as Resources Root are listed in the Project scope with blue folder icon.
Thanks
Hey, Grzegorz!
It's weird, I also don't see excluded folder in "Project Files" scope, but see it in "Project".
Probably your PhpStorm version handle excluded folders a little differently as mine. I can only suggest you update PhpStorm to the latest version, if you can. It should helps.
Cheers!
I went to my JetBrains account and realized that my license is valid with version 9. Doh. The excluded folders are shown correctly in v9. Thanks Victor :)
Ah, that's great! I love licences which include free upgrades for major versions.
Happy coding with your new PhpStorm! ;)
Latest Symphony plugin is installed on PhpStorm 2016.2 and there is no right-bottom-corner Symfony menu. Something changed from Symfony 2 version or I just wrong at plugin installation?
Hey Egor,
Did you activate Symfony plugin for project? Most probably you didn't. You can activate it in "Preferences" => "Languages and Frameworks" => "PHP" => "Symfony" and check "Enable Plugin..." item. Also ensure you have correct paths there and don't forget to restart PhpStorm.
Cheers!
Following along with no issues, until the very end: http://localhost:8000 did not produce symfony page, and no symfony menu in bottom right-hand. I do have the plugin installed; and I did restart PhpStorm. I'm running 10.0
Hi there!
To actually get the application running, go into your terminal and run this command (from inside the project's directory):
php app/console server:run
You can see more about this here: http://knpuniversity.com/screencast/symfony2-ep1/installation#setup-checks-and-web-server-config
I don't think I mentioned this in the screencast - this is more a "how do I get my Symfony app" running - it's not related to PhpStorm. But, I probably should have mentioned it :).
Cheers!
Hello,
I ran "php app/console server:run" from start directory and got this error:
"Warning: require_once(/Users/dougouverson/Sites/phpstorm/start/app/bootstrap.php.cache): failed to open stream: No such file or directory in /Users/dougouverson/Sites/phpstorm/start/app/console on line 10
Fatal error: require_once(): Failed opening required '/Users/dougouverson/Sites/phpstorm/start/app/bootstrap.php.cache' (include_path='.:') in /Users/dougouverson/Sites/phpstorm/start/app/console on line 10"
Could you please recommend a video or resource to help me with getting symfony running on my Mac.
FYI: I'm a Drupal site-builder, learning PHP programming within Drupal 8 content. I'm not a complete newbie (I have 8+ years experience as sysadmin), but I am new to symfony.
Thank you, and kind regards,
Hey again!
Ah, welcome! Thanks for giving me your background - that's very helpful. I'm the opposite - a guy with a ton of Symfony experience, but I'm still learning Drupal 8, so I know how it is :).
To fix this issue, you need to install your vendors via composer. I realize that we need to do a better job with the setup README instructions - sometimes I assume that certain tutorials are only watched by devs with a bunch of Symfony experience already :). Anyways, here is a good README: https://github.com/knpunive.... You don't think you'll need to do the Doctrine database steps - so you can skip those (but are free to do them if you want).
For starting with Symfony, I'd recommend starting here: http://knpuniversity.com/sc.... The tutorials are not perfectly up to date, but it's the best place to start (and we're updating them right now!).
Cheers!
Thank you so very much. Still having issues. Think it would be good to start with course referenced. Kind regards,
// composer.json
{
"require": {
"php": ">=5.3.9, <7.3.0",
"symfony/symfony": "2.8.*", // v2.8.15
"doctrine/orm": "^2.4.8", // v2.4.8
"doctrine/dbal": "<2.5", // v2.4.5
"doctrine/doctrine-bundle": "~1.4", // 1.6.4
"symfony/assetic-bundle": "~2.3", // v2.8.1
"symfony/swiftmailer-bundle": "~2.3,>=2.3.10", // v2.4.2
"symfony/monolog-bundle": "^3.0.2", // v3.0.2
"sensio/distribution-bundle": "~5.0", // v5.0.17
"sensio/framework-extra-bundle": "^3.0.2", // v3.0.18
"incenteev/composer-parameter-handler": "~2.0" // v2.1.2
},
"require-dev": {
"sensio/generator-bundle": "~3.0", // v3.1.2
"symfony/phpunit-bridge": "~2.7" // v2.8.15
}
}
The Idea editor philosophy has seen me dump Emacs as my coding editor. Everything it has has been introduced intelligently and smoothly. A tad expensive for PHPStorm but there is a CE (free) for Java and Android development. A wonderful editor choice.