igraal / stats-table-bundle
Symfony bundle to work with stats-table
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 8 952
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^5.6|^7.0
- igraal/stats-table: ^1.0
- sensio/framework-extra-bundle: >=2.3,<6
Requires (Dev)
- phpmd/phpmd: *@dev
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: 2.0.*@dev
- symfony/console: ^2.3|^3.0
- twig/twig: ^1.0
Suggests
- phpoffice/phpexcel: Allow to export to Excel file. Add phpoffice/phpexcel *@stable
This package is not auto-updated.
Last update: 2023-10-28 11:22:47 UTC
README
Add symfony wrapper to use igraal/stats-table as controller returned value.
All you have to do is to add a route with a .xls, .json or .csv extension and then add the @StatsTableResult
annotation to your controller's action. It will automatically detect the extension of your route and convert the StatsTable
into a file with the correct format.
For more information on the StatsTable
usage, please read StatsTable documentation
Installation
This bundle requires and is based on Sensio Framework Extra Bundle.
Using composer
Add igraal/stats-table-bundle to your requirements :
{ "require": { ..., "igraal/stats-table-bundle": "*" } }
Additional packages
Also add phpoffice/phpexcel
for .xls file support.
Declare the bundle
Edit your AppKernel.php
file to add the bundle :
$bundles = [ ..., new IgraalOSB\StatsTableBundle\IgraalOSBStatsTableBundle(), ];
Usage
All you have to do is add the @StatsTableResult
annotation to your controller's annotations.
This is a sample Controller file :
// Controller/MyController.php use IgraalOSB\StatsTableBundle\Configuration\StatsTableResult; class MyController extends BaseController { /** * @Route("/stats-table-test.{_format}", requirements={"_format": "json|xls|csv"}) * @StatsTableResult */ public function statsTableTestAction() { return new \IgraalOSL\StatsTable\StatsTable( [[1, 1], [2, 3]], ['One', 'Two'] ); } }