2017 © Pedro Peláez
 

project blog-bundle

Symfony GoreBlogBundle

image

petegore/blog-bundle

Symfony GoreBlogBundle

  • Friday, September 19, 2014
  • by petegore
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • CSS
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 3 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

GoreBlogBundle

A Symfony2 blog bundle (work in progres), (*1)

This bundle is not complete : the blog misses a lot of functionalities, and many bug remain., (*2)

I put it in GitHub / Packagist in order to use & test it in parallele of the dev. You can check the progress on my developper blog that I just initiated at the same time as the bundle : http://www.petegore.fr, (*3)

Thanks for your comprehension :), (*4)

Uses

GoreBlodBundle uses different existing bundles like : * FOSUserBundle : user management * HWIOAuthBundle : connection with Twitter, Fb, etc... * StofDoctrineExtensionsBundle : to user Doctrine extensions such as Sluggable * StfalconTinymceBundle : to load TinyMCE as text editor for articles, (*5)

All these bundles will be installed at the same time as the BlogBundle., (*6)

Installation

Requiring the main bundle

Add the following requirements to your composer.json :, (*7)

# composer.json

"require": {
    ...
    "petegore/blog-bundle": "dev-master"
},

And then run the update composer command : ``` bash $ php composer.phar update, (*8)




## Enabling the bundles ``` php # app/AppKernel.php $bundles = array( ... /** Blog and associated bundles **/ new Gore\BlogBundle\GoreBlogBundle(), new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), new FOS\UserBundle\FOSUserBundle(), new Stfalcon\Bundle\TinymceBundle\StfalconTinymceBundle(), new HWI\Bundle\OAuthBundle\HWIOAuthBundle(), );

Creating the main route

Add main blog route and FOSUserBundle routes :, (*9)

``` yaml, (*10)

app/config/routing.yml

ROUTING FOR HWIOAUTHBUNDLE : LET BEFORE THE OTHER ROUTES

hwi_oauth_redirect: resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml" prefix: /connect, (*11)

hwi_oauth_login: resource: "@HWIOAuthBundle/Resources/config/routing/login.xml" prefix: /login, (*12)

ROUTING FOR BLOGBUNDLE

blog: resource: "@GoreBlogBundle/Resources/config/routing/routing.yml" prefix: /, (*13)

ROUTING FOR FOSUSERBUNDLE

fos_user_security: resource: "@FOSUserBundle/Resources/config/routing/security.xml", (*14)

fos_user_profile: resource: "@FOSUserBundle/Resources/config/routing/profile.xml" prefix: /profile, (*15)

fos_user_register: resource: "@FOSUserBundle/Resources/config/routing/registration.xml" prefix: /register, (*16)

fos_user_resetting: resource: "@FOSUserBundle/Resources/config/routing/resetting.xml" prefix: /resetting, (*17)

fos_user_change_password: resource: "@FOSUserBundle/Resources/config/routing/change_password.xml" prefix: /profile, (*18)

logout: pattern: /logout, (*19)




## Create the security.yml file

app/config/security.yml

security: encoders: Symfony\Component\Security\Core\User\User: plaintext FOS\UserBundle\Model\UserInterface: sha512, (*20)

role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: [ROLE_ADMIN]

providers:
    fos_userbundle:
        id: fos_user.user_provider.username

firewalls:
    main:
        pattern: ^/
        form_login:
            provider: fos_userbundle
            csrf_provider: form.csrf_provider
        logout:       true
        anonymous:    true

access_control:
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/admin/, role: ROLE_ADMIN }



## Updating the database schema Update your database schema bu running update ``` bash $ php app/console doctrine:schema:update --force

Create your own admin user

By running the commands (for example) : ``` bash $ php app/console fos:user:create admin admin@mywebsite.com admin $ php app/console fos:user:promote admin ROLE_ADMIN, (*21)




## Updating the assets Run assets:install in order to install the public resources : ``` bash $ php app/console assets:install web/

Creating a pictures folder

Create a folder to store articles pictures into your web/ folder. For example : "web/pictures" Note : the article creation process will create subfolders based on year and month., (*22)

Set the minimal configuration

You only have to define the pictures folder into the YAML config file :, (*23)

``` yaml, (*24)

app/config/config.yml

Blog configuration

gore_blog: pictures_folder: pictures/ # will be completer later, (*25)

FOSUserBundle

fos_user: db_driver: orm firewall_name: main user_class: Gore\BlogBundle\Entity\User, (*26)

Doctrine extensions bundle

stof_doctrine_extensions: default_locale: %locale% orm: default: sluggable: true, (*27)

Text editor and syntax highlighter

stfalcon_tinymce: tinymce_jquery: true selector: ".tinymce" language: %locale% external_plugins: sh4tinymce: url: "asset[bundles/goreblog/lib/tinymce-plugin/sh4tinymce/plugin.js]" theme: simple: ~ advanced: plugins: - "advlist autolink lists link image charmap print preview hr anchor pagebreak" - "searchreplace wordcount visualblocks visualchars code fullscreen" - "insertdatetime media nonbreaking save table contextmenu directionality" - "emoticons template paste textcolor" toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image" toolbar2: "print preview media | forecolor backcolor emoticons | stfalcon | example", (*28)




## Customizing the blog Here is an example of the complete configuration you car put on the blog : ``` yaml gore_blog: pictures_folder: pictures/ blog_title: Chroniques d'un devweb main_articles_to_show: 2 small_articles_to_show: 3 social_networks_urls: email: test@myblog.com twitter : http://twitter.com/mypseudoontwitter ### etc... many social networks are availables

@TOFINISH, (*29)

The Versions