Simple small bundle for simple blogs
This version of the bundle requires:
- Symfony >= 2.0
- LiipFunctionalTestBundle for testing (optional)
- DoctrineFixturesBundle for fixtures (optional)
- SonataAdminBundle for administering
- StofDoctrineExtensionsBundle for timestamps
- KnpPaginatorBundle for pagination
Installation is a quick 4 step process:
- Add BlogBundle in your composer.json
- Enable the Bundle
- Import BlogBundle routing and update your config file
- Update your database schema
{
"require": {
"stfalcon/blog-bundle": "*"
}
}
Now tell composer to download the bundle by running the command:
$ php composer.phar update stfalcon/blog-bundle
Composer will install the bundle to your project's vendor/stfalcon
directory.
Finally, enable the bundle in the kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Stfalcon\Bundle\BlogBundle\StfalconBlogBundle(),
// for use KnpMenuBundle
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
// for use KnpPaginatorBundle
new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
// for use StofDoctrineExtensionsBundle
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
// for use SonataAdminBundle
new Sonata\CacheBundle\SonataCacheBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
new Sonata\jQueryBundle\SonatajQueryBundle(),
);
}
Now that you have installed and activated the bundle, all that is left to do is import the StfalconBlogBundle and SonataAdminBundle routings:
In YAML:
# app/config/routing.yml
_stfalcon_blog:
resource: "@StfalconBlogBundle/Resources/config/routing.yml"
admin:
resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
prefix: /admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin
See more info about routing in SonataAdminBundle
Add following lines to your config file:
In YAML:
# app/config/config.yml
# StfalconBlogBundle Configuration
stfalcon_blog:
disqus_shortname: "your-disqus-shortname-goes-here"
rss:
title: "your-blog-title-goes-here"
description: "your-blog-description-goes-here"
# Sonata Configuration
sonata_block:
default_contexts: [cms]
blocks:
sonata.admin.block.admin_list:
contexts: [admin]
# DoctrineExtensionsBundle
stof_doctrine_extensions:
default_locale: en_US
orm:
default:
timestampable: true
Now that the bundle is configured, the last thing you need to do is update your
database schema because you have added a two new entities, the Post
and the Tag
.
Run the following command.
$ php app/console doctrine:schema:update --force
$ php app/console assets:install
At this point you can already access the admin dashboard by visiting the url: http://yoursite.local/admin/dashboard. Getting started with SonataAdminBundle
Now that you have completed the installation and configuration of the BlogBundle!