Installation
Clone the repo and add to composer.json:
composer require ee/tellyourstory-bundle
Ensure AppKernel.php includes:
new EE\TYSBundle\EETYSBundle(),
new TB\TYSBundle\TBTYSBundle(),
Required Config
Add to config.yml:
fos_rest:
param_fetcher_listener: force
body_listener: true
format_listener: true
view:
view_response_listener: 'force'
routing_loader:
default_format: json
sensio_framework_extra:
view: { annotations: false }
First Use Case
Run migrations (if provided) and test the API endpoints (e.g., /api/stories).
Verify BootstrapBundle assets load (check /bundles/mopabootstrap/).
Story Creation Use FOSRest annotations for API endpoints:
use FOS\RestBundle\Controller\Annotations\Route;
use FOS\RestBundle\Controller\Annotations\NamePrefix;
class StoryController extends Controller {
/**
* @Route("/stories", name="story_create", methods={"POST"})
* @NamePrefix("api_")
*/
public function createAction() {
// Logic to save story via TB\TYSBundle
}
}
Serialization Leverage JMS Serializer for story DTOs:
# config/serializer/Story.yml
TB\TYSBundle\Entity\Story:
exclusion_policy: ALL
properties:
id: { expose: true }
title: { expose: true }
content: { expose: true }
Frontend Integration Use MopaBootstrapBundle for UI components:
{% block stylesheets %}
{{ parent() }}
{{ mopa_bootstrap_stylesheets() }}
{% endblock %}
DoctrineFixturesBundle for seed data:
php app/console doctrine:fixtures:load --append
EETYSBundle events (e.g., story.pre_publish).use Symfony\Component\Validator\Constraints as Assert;
class Story {
/**
* @Assert\Length(min=10)
*/
private $content;
}
Bundle State
Missing Docs
TB\TYSBundle\Resources/config/routing.yml and EETYSBundle/Event/ for clues.FOSRest Conflicts
param_fetcher_listener: force may break nested routes.GET/POST separately or adjust to true.config_dev.yml:
web_profiler: { toolbar: true, intercept_redirects: false }
php app/console debug:serializer
Custom Story Fields
Extend TB\TYSBundle\Entity\Story and update serializer mappings.
API Versioning
Use FOSRest’s format parameter for versioning:
# routing.yml
story_create:
path: /api/v1/stories
defaults: { _format: json }
Bootstrap Themes
Override MopaBootstrap templates in app/Resources/MopaBootstrapBundle/views/.
How can I help you explore Laravel packages today?