Automatic Code Generation with IntelliJ and PhpStorm

Get the generated code for constructors, getters, and setters to follow your own naming conventions! Create a class, define what class attributes it has, and ask IntelliJ or PhpStorm to generate the constructor and some getters and setters for us. This is something we have been doing since the days of Eclipse or NetBeans, the problem is: Can we get this generated code to follow our naming conventions? In this video, we will see just that, how to configure IntelliJ or PhpStorm so that the code it generates follows the structure we define (prefixes "a" or "an" for constructor input parameters and setters, prefixes "some" and "all" for element arrays, and some more tricks).

Related Material

As I mentioned in the video, here’s the repository with the settings used. In this repository, you will find the content of the .jar file that PhpStorm generates when exporting these settings. This way, you can play around and, if you want, make a Pull Request with your modifications :) . If you only want to import the settings, here’s the .jar ready for import. I also especially recommend that if you are interested in this type of settings for PhpStorm, you check out the video on namespaces and Composer autoloader since we set up PhpStorm there to generate classes with the appropriate namespace according to PSR-4. Additionally, the video on configuring PhpStorm to follow the PSR-2 coding style standard might also be useful for you.

Video

Pay according to your needs

lite (only monthly)

19 €
per month
  • Access to a subset of courses to lay the foundation for maintainable, scalable, and testable code
  • Company invoice
Popular

standard

24,92 €
Save 121
Annual payment of 299
per month
  • Full course catalog
  • Design and architecture challenges
  • Highlighted solutions videos for challenges
  • Receive job offers verified by Codely
  • Company invoice

premium

41,58 €
Save 89
Annual payment of 499
per month
  • Everything above
  • More benefits coming soon

We won’t increase the price while your subscription is active