-
Notifications
You must be signed in to change notification settings - Fork 76
Update the chapter extensions for Contao 4 #425
base: 4.2
Are you sure you want to change the base?
Changes from 1 commit
d53f496
759a2f3
1c835f6
24ae224
7d55931
06a85b6
36cfc64
6645432
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,135 @@ | ||
## Extensions | ||
## Extensions and bundles | ||
|
||
Extensions are an essential part of Contao, because they allow you to add extra | ||
functionality. There are more than 1,400 extensions available in the Contao | ||
Extension Repository, which you can browse directly in the back end. | ||
Communication with the repository server is done via SOAP, so you need to enable | ||
the PHP SOAP extension to use the service (if not enabled by default). | ||
functionality. There are more than 1,800 extensions available in the Contao | ||
[Extension Repository][1]. | ||
|
||
Contao 4 is built on top of the Symfony framework and takes advantage of its | ||
functionalities but also of its terminology. In a Symfony project, an extension | ||
is named a bundle. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would rephrase this whole paragraph to:
|
||
|
||
### Extension catalog | ||
|
||
The "extension catalog" module allows you to browse the extension list and to | ||
install extensions at the push of a button. Use the filter and sorting options | ||
to find a particular extension and click the info icon or extension title to | ||
open the details page and install the module. | ||
### Finding extensions or bundles | ||
|
||
![](images/extension-list.jpg) | ||
Contao has its own [repository][1] where you can find the extensions that are | ||
compatible with Contao 3.x and lower. | ||
|
||
The details page contains a description of the extension and important | ||
information regarding system requirements, versions and dependencies from other | ||
modules. Click the "Install" button to download and install the extension. | ||
The second most commonly used repository is [Packagist][2]. It lists the | ||
extensions and bundles installable through [Composer][3]. | ||
|
||
1. [List of Contao 4 bundles][4] in Packagist. | ||
2. [List of Contao 3 extensions][5] in Packagist. | ||
|
||
![](images/extension-details.jpg) | ||
|
||
Contao will automatically download and install the extension and update the | ||
database if necessary. | ||
### Installing a bundle with Composer | ||
|
||
![](images/extension-install.jpg) | ||
A name of a bundle is divided into two parts. The first part is the name of the | ||
vendor (project owner) and the second the bundle name. For example: | ||
`contao/news-bundle`. | ||
|
||
Run the command `php composer.phar require vendor/bundleName` in your | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't that be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modified in 1c835f6 |
||
command-line interface to start the installation. | ||
|
||
### Extension manager | ||
Contao dependencies (in our case a bundle) are described in a file named | ||
`composer.json` which is located in the root folder of your Contao installation. | ||
During the installation process, Composer updates the `composer.json` file and | ||
determines itself which version of the bundle is best suited to be installed | ||
depending on your version of Contao. | ||
|
||
The "extension manager" module allows you to update and uninstall extensions. It | ||
automatically checks for updates and notifies you if a new version is available. | ||
Many extensions also include links to an online manual and/or forum thread where | ||
you can get support. | ||
Then you must register your bundle in `app/AppKernel.php` so that it can be | ||
taken into account by the system. Add the bundle to the list of registered | ||
bundles: | ||
|
||
![](images/extension-manager.jpg) | ||
```php | ||
<?php | ||
// app/AppKernel.php | ||
|
||
To uninstall an extension, simply click the uninstall icon and follow the | ||
instructions. The extension manager will remove all files and folders and update | ||
the database if necessary. Note that this action cannot be undone and the tables | ||
cannot be restored! | ||
// ... | ||
class AppKernel extends Kernel | ||
{ | ||
public function registerBundles() | ||
{ | ||
$bundles = [ | ||
// ... | ||
|
||
![](images/extension-uninstall.jpg) | ||
new <vendor>\<bundle-name>\<bundle-long-name>(), | ||
]; | ||
|
||
// ... | ||
} | ||
|
||
### Manual installation | ||
// ... | ||
} | ||
``` | ||
|
||
In case the PHP SOAP extension is not available on your server, you can also | ||
install Contao extensions manually. Find the respective module in the [extension | ||
list][1] and download the .zip archive of the latest release. Then unzip the | ||
files and copy them to your local or remote Contao directory. Finally, check the | ||
database with the [Contao install tool][2]. | ||
Finally, check the database with the [Contao install tool][7]. | ||
|
||
With Composer, the cache is cleared automatically. | ||
|
||
|
||
### Installing a Contao extension | ||
|
||
An extension can be installed with Composer or manually. With Composer, the | ||
installation process is the same as a bundle except for the registration in the | ||
`app/AppKernel.php` file where the code is slightly different. | ||
|
||
Add the following line as in the example below by changing the first parameter | ||
`myExtensionName` with the name of your extension. | ||
|
||
```php | ||
new Contao\CoreBundle\HttpKernel\Bundle\ContaoModuleBundle('myExtensionName', $this->getRootDir()), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this line is obsolete if we have an example of |
||
``` | ||
|
||
```php | ||
<?php | ||
// app/AppKernel.php | ||
|
||
// ... | ||
class AppKernel extends Kernel | ||
{ | ||
public function registerBundles() | ||
{ | ||
$bundles = [ | ||
// ... | ||
|
||
new Contao\CoreBundle\HttpKernel\Bundle\ContaoModuleBundle('myExtensionName', $this->getRootDir()), | ||
]; | ||
|
||
// ... | ||
} | ||
|
||
// ... | ||
} | ||
``` | ||
|
||
|
||
#### Manually | ||
|
||
Find the extension you want to install in the [Extension Repository][1] and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add an intro like this:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added in 1c835f6 |
||
download the .zip archive of the latest release. Then unzip the files and copy | ||
them to the `system/modules` folder. If the extension has public files, you must | ||
generate a [symbolic link][6] with the command `php app/console contao:symlinks` | ||
in your command-line interface. | ||
|
||
Then you must register your extension in `app/AppKernel.php` so that it can be | ||
taken into account by the system (see the previous chapter). Finally, check the | ||
database with the [Contao install tool][7]. | ||
|
||
When you have made all the installation procedure, you can clear the cache with | ||
the following command: `php app/console cache:clear -e=prod`. | ||
|
||
|
||
## Extension catalog | ||
|
||
Prior to Contao 4, it was possible to install an extension automatically from | ||
the back end. This feature is under development and will be offered in a future | ||
release. | ||
|
||
|
||
[1]: https://contao.org/en/extension-list.html | ||
[2]: ../01-installation/installing-contao.md#the-contao-install-tool | ||
[2]: https://packagist.org | ||
[3]: https://getcomposer.org/doc/00-intro.md#introduction | ||
[4]: https://packagist.org/search/?q=&type=contao-bundle | ||
[5]: https://packagist.org/search/?q=&type=contao-module | ||
[6]: ../01-installation/installing-contao.md#symbolic-link | ||
[7]: ../01-installation/installing-contao.md#the-contao-install-tool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lowercase C for content