contao-4-documentation

Some basic stuff for working with Contao 4

View the Project on GitHub jodermo/contao-4-documentation

Contao 4 - Add Custom Bundles

by Moritz Petzka petzka.com
Example Bundle: github.com/jodermo/petzka-demo-bundle


Add Bundle as Git-Repository

add code to <contao root path>/composer.json

{
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/jodermo/petzka-demo-bundle.git"
        }
    ],
    "require": {
        "petzka/demo-bundle": "dev-master"
    },
    "config": {
        "preferred-install": {
            "petzka/*": "source",
            "*": "dist"
        }
    },
}
! Note: use version prefix dev- as long as there is no stable release, e.g:
"petzka/demo-bundle": "dev-master"


Add Bundle as local Repository

add code to <contao root path>/composer.json

{
    "...": "...",
    "repositories": [
        {
            "type": "path",
            "url": "repositories/petzka-demo-bundle"
        }
    ],
    "require": {
        "...": "...",
        "petzka/demo-bundle": "dev-master"
    },
    "config": {
        "preferred-install": {
            "petzka/*": "source",
            "*": "dist"
        }
    },
}


Method A: Install Bundle with composer

Enter SSH server
ssh -p 22 -t username@your-domain "cd public_html/www; exec \$SHELL -l"

replace: 22 with port number,
username@your-domain with your credentials
and: public_html/www with path to your contao installation

Run composer update
php composer.phar update


Method B: Install Bundle with Contao Manager

Enter Contao Manager

Type URL <your domain>/contao-manager.phar.php in your Browser and enter login credentials to launch Contao Manager

contao_manager_home You should see the hint that there is a new package

Go to “PACKAGES”

contao_manager_home You should see your new package listed

Click on “Apply Changes”

contao_manager_home That should take a while

Click Update database

contao_manager_home

Login to Install Tool and update database

contao_manager_home

Installation done

contao_manager_home go to Contao backend

Bundle ready

contao_manager_home


Troubleshooting
Overwiev