Git Product home page Git Product logo

gregamohorko / bluedb Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 1.74 MB

MySQL ORM library with Database First model that lets you create Entities with complex relationships and queries.

License: Apache License 2.0

PHP 100.00%
php mysql entity query one-to-many many-to-many many-to-one entity-framework wrapper database entities php-mysql-library complex-relationships database-first entity-relationship criteria expression table-inheritance json orm

bluedb's Introduction

BlueDB

A PHP MySQL ORM library with Database First model that lets you create Entities with base properties and complex relationships (One-To-Many, Many-To-One, Many-To-Many, Table Inheritance, Associative tables), supports queries with expressions, JSON encoding/decoding and is simple to use.

Check the BlueDBClient.NET for a .NET client library to use on the .NET client side.

Release

Documentation & Tutorials

You can read the documentation and tutorials under the Wiki.

Short examples

Let's assume that we have an entity User.

Loading all entries:

$all = User::loadList();

This would load all entries with all fields.

Let's say that we want only the Username fields:

$all = User::loadList([User::UsernameField]);

How about loading only those users, whose Username starts with "Ja"?

Simple, we use the Criteria class:

$criteria = new Criteria(User::class);
$criteria->add(Expression::startsWith(User::class, User::UsernameField, "Ja"));
$results = User::loadListByCriteria($criteria);

Encoding/decoding entities to/from JSON? No problem!

$json = JSON::encode($entity);
$entity = JSON::decode($json);

Creating a new entry:

$gordon = new User();
$gordon->Username = "Gordon";
User::save($gordon);

Updating entries:

// let's change Gordons username to 'Freeman'
$gordon->Username = "Freeman";
User::update($gordon);

Deleting entries:

// let's delete Gordon
User::delete($gordon);

These short examples are just the top of the iceberg, BlueDB has many many more cool features. To find them out and for more complex examples & tutorials, please go to Wiki.

Requirements

PHP version >= 5.5

Author and License

Gregor Mohorko (www.mohorko.info)

Copyright (c) 2022 Gregor Mohorko

Apache License 2.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.