Giter VIP home page Giter VIP logo

core-bundle's Introduction

Contao 4 core bundle

Contao is an Open Source PHP Content Management System for people who want a professional website that is easy to maintain. Visit the project website for more information.

Contao 4 has been designed as a Symfony bundle, which can be used to add CMS functionality to any Symfony application. If you do not have an existing Symfony application yet, we recommend using the Contao managed edition as basis for your application.

Installation

Edit your composer.json file and add the following:

"require": {
    "contao/core-bundle": "4.5.*",
    "contao/installation-bundle": "^4.5",
    "php-http/guzzle6-adapter": "^1.1"
},
"config": {
    "component-dir": "assets"
},
"post-install-cmd": [
    "Contao\\CoreBundle\\Composer\\ScriptHandler::addDirectories",
    "Contao\\CoreBundle\\Composer\\ScriptHandler::generateSymlinks"
],
"post-update-cmd": [
    "Contao\\CoreBundle\\Composer\\ScriptHandler::addDirectories",
    "Contao\\CoreBundle\\Composer\\ScriptHandler::generateSymlinks"
]

Then run php composer.phar update to install the vendor files.

Note that you can exchange the php-http/guzzle6-adapter package with any other HTTP client implementation. If you already have an HTTP client implementation, you can omit the package entirely.

Activation

Remove the parameters.yml import from your app/config/config.yml file:

imports:
    - { resource: parameters.yml } # <-- remove this line
    - { resource: security.yml }

Then adjust to your app/AppKernel.php file:

// app/AppKernel.php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
            new Knp\Bundle\TimeBundle\KnpTimeBundle(),
            new Nelmio\CorsBundle\NelmioCorsBundle(),
            new Contao\CoreBundle\ContaoCoreBundle(),
            new Contao\InstallationBundle\ContaoInstallationBundle(),
        ];
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $rootDir = $this->getRootDir();

        if (file_exists($rootDir.'/config/parameters.yml')) {
            $loader->load($rootDir.'/config/parameters.yml');
        }

        $loader->load($rootDir.'/config/config_'.$this->getEnvironment().'.yml');
    }
}

Configuration

Add the Contao routes to your app/config/routing.yml file:

ContaoInstallationBundle:
    resource: "@ContaoInstallationBundle/Resources/config/routing.yml"

ContaoCoreBundle:
    resource: "@ContaoCoreBundle/Resources/config/routing.yml"

Edit your app/config/security.yml file:

security:
    providers:
        contao.security.backend_user_provider:
            id: contao.security.backend_user_provider

        contao.security.frontend_user_provider:
            id: contao.security.frontend_user_provider

    encoders:
        default:
            algorithm: bcrypt

        legacy:
            id: contao.security.sha1_password_encoder

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt|error)|css|images|js)/
            security: false

        contao_install:
            pattern: ^/contao/install
            security: false

        contao_backend:
            entry_point: contao.security.entry_point
            request_matcher: contao.routing.backend_matcher
            provider: contao.security.backend_user_provider
            user_checker: contao.security.user_checker
            anonymous: ~
            switch_user: true
            logout_on_user_change: true

            contao_login:
                login_path: contao_backend_login
                check_path: contao_backend_login
                default_target_path: contao_backend
                success_handler: contao.security.authentication_success_handler
                failure_handler: contao.security.authentication_failure_handler
                remember_me: false

            logout:
                path: contao_backend_logout
                target: contao_backend_login
                handlers:
                    - contao.security.logout_handler

        contao_frontend:
            request_matcher: contao.routing.frontend_matcher
            provider: contao.security.frontend_user_provider
            user_checker: contao.security.user_checker
            anonymous: ~
            switch_user: false
            logout_on_user_change: true

            contao_login:
                login_path: contao_frontend_login
                check_path: contao_frontend_login
                default_target_path: contao_root
                failure_path: contao_root
                success_handler: contao.security.authentication_success_handler
                failure_handler: contao.security.authentication_failure_handler
                remember_me: true
                use_forward: true

            remember_me:
                secret: '%secret%'
                remember_me_parameter: autologin
                token_provider: contao.security.database_token_provider

            logout:
                path: contao_frontend_logout
                target: contao_root
                handlers:
                    - contao.security.logout_handler
                success_handler: contao.security.logout_success_handler

    access_control:
        - { path: ^/contao/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/contao, roles: ROLE_USER }

Edit your app/config/config.yml file and add the following:

# Contao configuration
contao:
    # Required parameters
    prepend_locale: "%prepend_locale%"

    # Optional parameters
    web_dir:              "%kernel.project_dir%/web"
    encryption_key:       "%kernel.secret%"
    url_suffix:           .html
    upload_path:          files
    csrf_token_name:      contao_csrf_token
    pretty_error_screens: true
    error_level:          8183 # E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED
    image:
        bypass_cache:     false
        target_dir:       "%kernel.project_dir%/assets/images"
        valid_extensions: ['jpg', 'jpeg', 'gif', 'png', 'tif', 'tiff', 'bmp', 'svg', 'svgz']
        imagine_options:
            jpeg_quality: 80
            interlace:    plane

You can also overwrite any parameter stored in the localconfig.php file:

# Contao configuration
contao:
    localconfig:
        adminEmail: [email protected]
        dateFormat: Y-m-d

License

Contao is licensed under the terms of the LGPLv3.

Getting support

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

core-bundle's People

Contributors

a-v-l avatar aschempp avatar ausi avatar aybee avatar backbone87 avatar bekanntmacher avatar bugbuster1701 avatar bytehead avatar davidenke avatar discordier avatar dmolineus avatar fritzmg avatar henobi avatar jamesdevine avatar kroka avatar leofeyer avatar marcobiedermann avatar mroi avatar mynyx avatar psi-4ward avatar qzminski avatar rolandschuetz avatar serhii-dv avatar stefanheimes avatar taca avatar tobaco avatar toflar avatar tristanlins avatar volkerrichert avatar xchs avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.