helios-ag / fm-lessql-bundle
Lessql bundle, adds LessQL ORM PHP to your Symfony project
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.3
- morris/lessql: ~0.3
- symfony/framework-bundle: ~2.1
Requires (Dev)
- phpunit/phpunit: ~4.6
This package is auto-updated.
Last update: 2024-10-29 01:02:05 UTC
README
LessQL integration in Symfony2
LessQL is a lightweight and powerful alternative to Object-Relational Mapping for PHP.
Installation
Step 1: Installation
Using Composer, just add the following configuration to your composer.json
:
Or you can use composer to install this bundle: Add FMBbcodeBundle in your composer.json:
composer require helios-ag/fm-lessql-bundle
Now tell composer to download the bundle by running the command:
composer update helios-ag/fm-lessql-bundle
Step 2: Enable the bundle
Finally, enable the bundle in the kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new FM\LessqlBundle\FMLessqlBundle(), ); }
Configuration
You can configure bundle as follows
fm_lessql: instances: default: dsn: sqlite:%kernel.root_dir%/test.sqlite3 username: '' password: '' options: mysql: dsn: mysql:host=localhost;dbname=testdb;charset=utf8 username: root password: 12345 options: 'PDO::ATTR_EMULATE_PREPARES': { value: false } 'PDO::ATTR_ERRMODE': { value: 'PDO::ERRMODE_EXCEPTION' }
##Usage Controller
class AppController extends Controller { /** * @Template() */ public function indexAction() { $db = $this->get('fm_lessql.manager')->getDB('default'); $posts = array(); $result = $db->table_name(); $result = $db->table( 'post' ); $row = $result->fetch(); // fetch next row in result $rows = $result->fetchAll(); // fetch all rows } }
More information can be found at http://lessql.net/