2017 © Pedro PelĂĄez
 

library typo3-fractal-view

Integrates the fractal package (https://fractal.thephpleague.com/) into TYPO3 Extbase

image

portrino/typo3-fractal-view

Integrates the fractal package (https://fractal.thephpleague.com/) into TYPO3 Extbase

  • Friday, November 17, 2017
  • by portrino-dev
  • Repository
  • 8 Watchers
  • 3 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

TYPO3 Fractal View

Build Status Code Climate Test Coverage Issue Count Latest Stable Version Total Downloads, (*1)

Integrates the fractal package (https://fractal.thephpleague.com/) into TYPO3 Extbase, (*2)

Installation

You need to add the repository into your composer.json file, (*3)

    composer require portrino/typo3-fractal-view

Extbase view

You can prepend ?tx_par_pi1[format]=json to your action controller request and extbase renders the corresponding view for you. By putting the FractalView class into the $viewFormatToObjectNameMap or $defaultViewObjectName extbase is able to get the correct view class for your request., (*4)

use Portrino\Typo3FractalView\Mvc\View\FractalView;
use Foo\Bar\Transformer\BookingTransformer;

class BookingController
{
    /**
     * @var array
     */
    protected $viewFormatToObjectNameMap = [
        'json' => FractalView::class
    ];

    /**
     * @var string
     */
    protected $defaultViewObjectName = FractalView::class;

    /**
     * Action Show
     *
     * @param \Foo\Bar\Domain\Model\Booking $booking
     *
     * @return void
     */
    public function showAction($booking)
    {
        $this->view->assign('booking', $booking);
        $view->setConfiguration([
            'booking' => BookingTransformer::class
        ]);
        $this->view->setVariablesToRender(['booking']);
    }

}

The only thing you have to do is implement the BookingTransformer class by your own like described here: https://fractal.thephpleague.com/transformers/, (*5)

Example:, (*6)

namespace Foo\Bar\Transformer;

use Foo\Bar\Domain\Model\Booking;

class BookingTransformer
{
   /**
     * @param Booking $booking
     * @return array
     */
    public function transform(Booking $booking)
    {
        return [
            'uid' => $booking->getUid(),
            'start' => $booking->getStart()->format(DateTime::ISO8601),
            'end' => $booking->getEnd()->format(DateTime::ISO8601)
        ];
    }
}

Authors

, (*7)

  • AndrĂ© Wuttig - Initial work, Unit Tests - aWuttig
  • Christian Deussen - Bugfixes - nullsub

See also the list of contributors who participated in this project., (*8)

The Versions

17/11 2017

dev-master

9999999-dev https://github.com/portrino/typo3-fractal

Integrates the fractal package (https://fractal.thephpleague.com/) into TYPO3 Extbase

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

json typo3 view fractal extbase

10/10 2017

0.2.0

0.2.0.0 https://github.com/portrino/typo3-fractal

Integrates the fractal package (https://fractal.thephpleague.com/) into TYPO3 Extbase

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

json typo3 view fractal extbase

09/10 2017

0.1.3

0.1.3.0 https://github.com/portrino/typo3-fractal

Integrates the fractal package (https://fractal.thephpleague.com/) into TYPO3 Extbase

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

json typo3 view fractal extbase

06/10 2017

0.1.2

0.1.2.0 https://github.com/portrino/typo3-fractal

Integrates the fractal package (https://fractal.thephpleague.com/) into TYPO3 Extbase

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

json typo3 view fractal extbase

05/10 2017

0.1.1

0.1.1.0 https://github.com/portrino/typo3-fractal

Integrates the fractal package (https://fractal.thephpleague.com/) into TYPO3 Extbase

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

json typo3 view fractal extbase

05/10 2017

dev-develop

dev-develop https://github.com/portrino/typo3-fractal

Integrates the fractal package (https://fractal.thephpleague.com/) into TYPO3 Extbase

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

json typo3 view fractal extbase

04/09 2017

0.1.0

0.1.0.0 https://github.com/portrino/typo3-fractal

Integrates the fractal package (https://fractal.thephpleague.com/) into TYPO3 Extbase

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

json typo3 view fractal extbase