| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sirius ORM is a fast and lightweight yet flexible data mapper solution developed with DX in mind. It offers:
composer require siriusphp/orm
use Sirius\Orm\Orm;
use Sirius\Orm\ConnectionLocator;
$connectionLocator = ConnectionLocator::new(
'mysql:host=localhost;dbname=testdb',
'username',
'password'
);
$orm = new Orm($connectionLocator);AKA, registering mappers and relations
$orm->register('pages', MapperConfig::fromArray([
/**
* here goes the configuration
*/
]));
// continue with the rest of mappers// find by ID
$page = $orm->find('pages', 1);
// or via the mapper
$page = $orm->get('pages')->find(1);
// query
$pages = $orm->select('pages')
->where('status', 'published')
->orderBy('date desc')
->limit(10)
->get();
// manipulate
$page->title = 'Best ORM evah!';
$page->featured_image->path = 'orm_schema.png';
// persist
$orm->save($page);
// or via the mapper
$orm->get('pages')->save($page);| Back | FazBrowse Home | New Git URL |