Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
PHP
tree: 256c455a02

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
models
tests
.gitignore
Nucleus.php
NucleusAnonymousModel.php
NucleusConnection.php
NucleusHelper.php
NucleusJoin.php
NucleusJoinMany.php
NucleusJoinManyMany.php
NucleusJoinOne.php
NucleusModel.php
NucleusQuery.php
NucleusRecord.php
NucleusResult.php
README.md
config.php

README.md

Nucleus is a zero-conf ORM for PHP. Simple to install, without any dependencies, Nucleus makes it easy to write queries without touching SQL.

<?php
// Instantiate Nucleus.
$nucleus = new Nucleus\Query();

// Run the query.
$posts = $nucleus->get('posts');

Favoring convention over configuration writing a complex join statement is as simple as specifying which tables to include. Using standard naming conventions an entire SQL statement can be generated by simply running:

<?php
$posts = $nucleus->get('posts, users, tags, comments, comments.users')

Once you've run a query you have access to its properties and related objects through standard PHP OOP practices. For example:

<?php
foreach ($posts as $post) {
    // The post title
    echo $post->title;

    // The related comments
    foreach ($post->comments as $comment) {

        // Comment data
        echo $comment->text;

        // Nested data
        echo $comment->user->name;
    }
}

At this point the library is simply a query library. There is no ability to update or save data.

Something went wrong with that request. Please try again.