geekco / cmsbundle
cms on top of symfony
Installs: 103
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 0
Open Issues: 0
Language:JavaScript
Type:symfony-bundle
Requires
- php: ^7.1.3
- ext-iconv: *
- friendsofsymfony/ckeditor-bundle: ^2.0
- gumlet/php-image-resize: 1.8.*
- helios-ag/fm-elfinder-bundle: ^9.2
- myclabs/deep-copy: ^1.7
- sensio/framework-extra-bundle: ^5.1
- symfony/asset: ^4.0
- symfony/console: ^4.0
- symfony/dotenv: ^4.0
- symfony/flex: ^1.0
- symfony/form: ^4.0
- symfony/framework-bundle: ^4.0
- symfony/lts: ^4@dev
- symfony/maker-bundle: ^1.0
- symfony/monolog-bundle: ^3.1
- symfony/orm-pack: ^1.0
- symfony/security-bundle: ^4.0
- symfony/security-csrf: ^4.0
- symfony/swiftmailer-bundle: ^3.1
- symfony/twig-bundle: ^4.0
- symfony/validator: ^4.0
- symfony/yaml: ^4.0
Requires (Dev)
- doctrine/doctrine-fixtures-bundle: ^3.0
- symfony/browser-kit: ^4.0
- symfony/phpunit-bridge: ^4.0
- symfony/profiler-pack: ^1.0
- symfony/web-server-bundle: ^4.0
This package is not auto-updated.
Last update: 2020-01-24 17:34:26 UTC
README
This project is not stable at all. In fact, the bundle is very helpful in my proper workflow, to build websites faster. It extracts my own logic when I build some admin dashboard and it is very opinionated and probably not convenient for your usage. Despite this warning, if you want to use it anyway, copy it and make your own bundle based on that!
Installation
Step 1: Install Symfony and download the CMS Bundle
If you definitly want to use this bundle, I strongly recommend to install it at the beginning of your project because cmsbundle relies heavily on overrides of controllers, routes. It will probably mess your project up if you install it in the middle of it. So, ideally first step: install Symfony.
$ composer create-project symfony/website-skeleton my-project
Then, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require geekco/cmsbundle:dev-master
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Import routes
# config/routes.yaml logout: path: /deconnexion geekco_cms_bundle: resource: '@GeekcoCmsBundle/Controller/' type: annotation
Step 3: change the locale if you are not english native speaker (like me)
# config/services.yml parameters: locale: 'fr'
Step 4: Load the services
// config/services.yaml services: Geekco\CmsBundle\: resource: '../vendor/geekco/cmsbundle/src/*' exclude: '../vendor/geekco/cmsbundle/src/{Entity,Migrations,Tests,Kernel.php}' Geekco\CmsBundle\Controller\: resource: '../vendor/geekco/cmsbundle/src/Controller' tags: ['controller.service_arguments'] Geekco\CmsBundle\EventListener\PageListener: tags: - { name: doctrine.event_listener, event: prePersist, lazy: true} - { name: doctrine.event_listener, event: preUpdate, lazy: true } Geekco\CmsBundle\EventListener\TagListener: tags: - { name: doctrine.event_listener, event: prePersist, lazy: true} - { name: doctrine.event_listener, event: preUpdate, lazy: true } Geekco\CmsBundle\EventListener\ResourceListener: tags: - { name: doctrine.event_listener, event: prePersist, lazy: true } - { name: doctrine.event_listener, event: postUpdate, lazy: true } Geekco\CmsBundle\Services\FileUploader: arguments: $targetDir: "%geekco_cms.targetDir%" Geekco\CmsBundle\Twig\TwigExtension: arguments: $targetDir: "%geekco_cms.targetDir%" $targetDir_relative: "%geekco_cms.targetDir_relative%" Geekco\CmsBundle\EventListener\ImageResourceListener: tags: - { name: doctrine.event_listener, event: prePersist, lazy: true} - { name: doctrine.event_listener, event: preUpdate, lazy: true} - { name: doctrine.event_listener, event: postLoad, lazy: true} - { name: doctrine.event_listener, event: preRemove, lazy: true} Geekco\CmsBundle\Services\ModuleManager: arguments: $targetDir: "%geekco_cms.targetDir%" $pathFixturesImg: "%kernel.project_dir%/src/DataFixtures/images/"
Step 5: Create the configuration file
# config/packages/geekco_cms.yaml geekco_cms: targetDir_relative: 'cms/uploads' targetDir: '%kernel.project_dir%/public/cms/uploads'
Step 6: Update some configuration's symfony packages
# config/packages/framework.yaml framework: # ... csrf_protection: true assets: packages: geekco_cms: base_path: /bundles/geekcocms/ json_manifest_path: '%kernel.project_dir%/public/bundles/geekcocms/build/manifest.json'
Step 7: Configure security.yaml
security: role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] encoders: Geekco\CmsBundle\Entity\User: algorithm: bcrypt # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers providers: our_db_provider: entity: class: Geekco\CmsBundle\Entity\User firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false main: pattern: ^/ user_checker: Geekco\CmsBundle\Security\UserChecker http_basic: ~ provider: our_db_provider switch_user: ~ anonymous: ~ # https://symfony.com/doc/current/security/form_login_setup.html form_login: login_path: geekco_cms_connexion check_path: geekco_cms_connexion csrf_token_generator: security.csrf.token_manager logout: path: /deconnexion target: / access_control: - { path: ^/admin, roles: ROLE_ADMIN }
Step 8: Load the entities
// config/packages/doctrine.yaml doctrine: orm: # ... mappings: Geekco_Cms: is_bundle: false type: annotation dir: '%kernel.project_dir%/vendor/geekco/cmsbundle/src/Entity' prefix: 'Geekco\CmsBundle\Entity' alias: Geekco_Cms
Then create your database (don't forget to check the DATABASE_URL in .env). And update your database schema with those commands:
$ bin/console doctrine:database:create $ bin/console doctrine:database:diff $ bin/console doctrine:database:migrate
Step 9: configure the mailer env parameter
In order to reset a password when it's requested by an admin, you must configure the MAILER_URL in your .env file located at the root of your project. If you use gmail, it could be:
MAILER_URL=gmail://gmail_username:gmail_password@localhost?encryption=tls&auth_mode=oauth
Step 10: symlink the assets
$ bin/console assets:install --symlink