Extending Bolt / Introduction
Note: You are currently reading the documentation for Bolt 4.0. Looking for the documentation for Bolt 5.0 instead?
This chapter has information about the two major ways to write custom code for (and "on top of") Bolt. Namely, developing extensions as well as adding custom to a specific Bolt project.
As you undoubtedly have discovered by now, Bolt 4 is a Symfony application through and through. This means that for extending the functionality, we heavily borrow from the tools and ecosystem that the Symfony network provides.
- Bolt extensions are true Composer packages. If you create a Bolt extension,
you can add it to packagist, and it will show up on the
Extensions site. You can install and remove it from a Bolt
- Custom code for a specific project can be put in the
src/folder. This follows the default Symfony project structure, and this folder is set up for Dependency Injection and Autowiring of Services.
Apart from the information contained in this chapter, it's very useful if you have some experience with PHP, as well as Symfony. Here's some recommended resources, if you want to brush up on your knowledge:
PHP in general:
- A good free book is PHP Pandas.
- There is a lot of information in PHP the Right Way, but it can also seem daunting and overwhelming. Likewise for Learn modern PHP.
- Be sure to grasp the concept of Dependency Injection, because its widely used in Symfony and Bolt. See Dependency Injection: Huh?.
- Obviously, the official documentation is very helpful: php.net
- Symfony's documentation is very extensive. Great resource, for users of all levels of expertise alike: Symfony documentation.
- There's a new Symfony: the fast track book, written by Symfony's lead developer. Currently, you can purchase it from the site, but supposedly it'll be published online in the near future as well.
- Symfonycasts has great video tutorials on all things Symfony.
Other than that, make sure you have a proper local development setup.
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.