24 lines
709 B
Markdown
24 lines
709 B
Markdown
# Bundles
|
|
|
|
## How to Create a bundle
|
|
|
|
[Official Symfony Docs - Create a bundle](https://symfony.com/doc/current/bundles.html#creating-a-bundle)
|
|
|
|
mkdir -p lib/bundleName/src
|
|
touch lib/bundleName/src/bundleName.php
|
|
|
|
You have to add the namespace\bundle name to config/bundles.php
|
|
```vendorName\bundleName\bundleName::class => ['all' => true],```
|
|
|
|
And you have to auto load the class by adding the next line in composer.json:
|
|
```
|
|
"autoload": {
|
|
"psr-4": {
|
|
"vendorName\\bundleName\\": "lib/bundleName/src/",
|
|
"App\\": "src/"
|
|
}
|
|
},
|
|
```
|
|
(replace vendorName\bundleName and make sure the directory is correct)
|
|
|
|
run ```composer dump-autoload``` after updating the composer.json |