First look at Bartacus
Integration of the Symfony full-stack framework into TYPO3 CMS
About me
- PHP backend guru at pixelart
- Symfony enthusiaist
- Small open source contributor
- Most contributions in Sylius
- Some in Sulu, Doctrine and Gaufrette
- More will follow in TYPO3 CMS
- And I like ranting on Twitter :P
Why?
- Old plugins are ugly
- Extbase is slow and ugly
- I love Symfony and Twig
But why?
- Twig
- Service Container
- Dependency Injection
But... but why?
- To know the TYPO3 CMS core better
- Master complex applications within CMS
- Because I can ^_^
Ok, how?
- require symfony/symfony
- create a custom Kernel class
- add some configs
- load it
Custom Kernel class
- Use our BartacusBundle on GitHub
- Create typical AppKernel class
- currently loaded in AdditionalConfiguarion.php
<?php
require_once PATH_site.'fileadmin/app/AppKernel.php';
use TYPO3\CMS\Core\Utility\GeneralUtility;
$context = GeneralUtility::getApplicationContext();
$kernel = new AppKernel((string)$context, $context->isDevelopment());
$kernel->boot();
The benefits
- Render templates with Twig
- A extension is a Symfony bundle
- Create classes as services
- And many more is coming
Rendering with Twig
<?php
use Bartacus\Bundle\BartacusBundle\Typo3\Plugin;
/**
* text element plugin
*/
class tx_content_text extends Plugin {
/**
* Execute the plugin, e.g. retrieve data, render it's content..
*
* @return string The content that is displayed on the website
*/
protected function execute() {
return $this->render('PixelartContent:Text:text.html.twig', $this->cObj->data);
}
}
Extension as Symfony bundle
<?php
// typo3conf/ext/content/Classes/PixelartContent.php
namespace Pixelart\Extensions\Content;
use Bartacus\Bundle\Bartacus\Typo3\Typo3Extension;
/**
* Transforms this extension to a "symfony bundle"
*
* @author Patrik Karisch <p.karisch@pixelart.at>
*/
class PixelartContent extends Typo3Extension {
}
Sneak peek
- Auto discovery of extension bundles
- Twig per block overrides
- Auto register of content plugins
- Doctrine DBAL and ORM
- Parse TCA from Doctrine Metadata
- Leverage full Symfony Routing and Controllers
- ....
Create a project with Bartacus
$ composer create-project --dev bartacus/bartacus-standard myproject 0.1.x-dev
Q & A
Thanks
First look at Bartacus
By Patrik Karisch
First look at Bartacus
- 1,272