Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manifestwebdesign/dabl-generator
DABL ORM code generator
https://github.com/manifestwebdesign/dabl-generator
Last synced: 15 days ago
JSON representation
DABL ORM code generator
- Host: GitHub
- URL: https://github.com/manifestwebdesign/dabl-generator
- Owner: ManifestWebDesign
- License: mit
- Created: 2016-07-04T06:28:17.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-16T06:49:14.000Z (almost 8 years ago)
- Last Synced: 2024-11-17T04:29:02.925Z (2 months ago)
- Language: PHP
- Size: 42 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/ManifestWebDesign/dabl-generator.svg?branch=master)](https://travis-ci.org/ManifestWebDesign/dabl-generator)
# dabl-generator
Simple MVC code generator## Example
### Setup
```php
use Dabl\Generator\DefaultGenerator;
use Dabl\Query\DBManager;// setup database connection
DBManager::addConnection('test', array(
'driver' => 'sqlite',
'dbname' => ':memory:'
));// create databse tables
$conn = DBManager::getConnection('test');
$conn->exec('CREATE TABLE user (
id INTEGER,
name,
PRIMARY KEY(id ASC)
)');$conn->exec('CREATE TABLE post (
id INTEGER,
user_id INTEGER,
content,
PRIMARY KEY(id ASC),
FOREIGN KEY(user_id) REFERENCES user(id)
)');
```### Generate
```php
$generator = new DefaultGenerator('test');
$generator->generateModels(
['user', 'post'],
'./models'
);$generator->generateViews(
['user', 'post'],
'./views'
);$generator->generateControllers(
['user', 'post'],
'./controllers'
);
```