contao/contao

Contao Open Source CMS development package

Fund package maintenance!
Other

Installs: 13 118

Dependents: 2

Suggesters: 0

Security: 18

Stars: 323

Watchers: 42

Forks: 156

Open Issues: 404

Type:symfony-bundle

5.3.7 2024-04-19 13:00 UTC

This package is auto-updated.

Last update: 2024-05-02 11:25:52 UTC


README

Contao Open Source CMS

About

Contao is a powerful open source CMS that allows you to create professional websites and scalable web applications. Visit the project website for more information.

Purpose

The purpose of this package is to develop the Contao bundles in a monorepo. Use it when you want to create a pull request or report an issue.

The monorepo is automatically split into separate packages:

Please do not use contao/contao in production! Use the split packages instead.

Platinum partners

Thanks to our platinum partners for helping us fund the development of Contao.

Development

To create a pull request and to test your changes within a running Contao application, it is the easiest to use the Contao Managed Edition. Start by installing it in your current directory:

composer create-project --no-install contao/managed-edition <directory> <branch>

Replace <directory> with the directory where you want to install the Managed Edition (use . for the current directory). Replace <branch> with 5.x-dev if you want to add a new feature, or with <lts-version>.x-dev (currently 4.13.x-dev) if you want to fix a bug.

Then adjust the require section in your composer.json file, so Composer loads the monorepo instead of the individual bundles:

"require": {
    "php": "^8.1",
    "contao/contao": "5.x-dev"
},

Again, use 5.x-dev if you want to add a new feature or <lts-version>.x-dev if you want to fix a bug.

Next, install the dependencies:

composer update

Composer automatically clones the Git repository into the vendor/contao/contao folder. You can complete the setup by running vendor/bin/contao-setup on the command line.

Any changes you make in vendor/contao/contao will be tracked via Git, so you can submit your pull request directly from your application.

Running scripts

First install the code quality tools:

composer bin all install

Then run the code quality scripts via Composer:

composer all

You can also run the scripts separately:

composer rector
composer ecs
composer service-linter
composer monorepo-tools
composer unit-tests
composer functional-tests
composer phpstan
composer depcheck

Use the -- argument to pass additional flags to the underlying commands:

composer unit-tests -- --filter CoreBundle
composer ecs -- --clear-cache

Functional tests

To set up the functional tests, create a database named contao_test:

mysql -e "CREATE DATABASE contao_test"

If your database uses credentials, copy the file core-bundle/phpunit.xml.dist to core-bundle/phpunit.xml and adjust the following line:

<php>
    <env name="DATABASE_URL" value="mysql://root@localhost:3306/contao_test" />
</php>

Then run the functional tests via Composer:

composer functional-tests

Yarn 4

To build the assets and to run the end-to-end tests (see below), you need to enable Corepack, a package manager that allows you to manage different Yarn package versions across multiple projects:

corepack enable

If Corepack is not bundled with your Node.js installation, you might have to install it as a separate package, e.g. using npm install -g corepack or brew install corepack.

End-to-end tests

The Contao end-to-end tests are availabe as an NPM package. You can install and run them via Yarn:

yarn add contao-e2e-tests --dev
yarn contao-e2e-tests

License

Contao is licensed under the terms of the LGPLv3.

Getting support

Visit the support page to learn about the available support options.