verem/persitencemanager

A simple orm for lightweight applications

dev-master 2016-08-19 21:33 UTC

This package is not auto-updated.

Last update: 2024-04-13 15:50:27 UTC


README

Build Status

#Persistence Manager Persistence Manager is a lightweight ORM based on concepts borrowed from the laravel framework

#Testing The phpunit framework for testing is used to perform unit test on the classes. The TDD principle has been employed to make the application robust

Run this on bash to execute the tests

/vendor/bin/phpunit

#Install

  • To install this package, PHP 5.5+ and Composer are required
composer require verem/persitencemanager

#usage

  • When creating a model, PersistenceManager maps the name of the table to the Model name, replacing any camel cases with underscores and replaces it with the plural form of the word.

      UserRole maps to table user_roles
  • Save a record to database

$user = new User();
$user->username = "john";
$user->password = "password";
$user->email = "john@doe.co";
$user->save();
  • Find a record from the database
$user = User::find($id);
  • Update a record
$user = User::find($id);
$user->password = "s†røngerPaSswoRd";
$user->save();
  • Delete a record -- returns a boolean
$result = User::destroy($id):
  • Find a record based on column value - Returns an object
$user = User::where('username', 'john');
``````

- Find all users in the database - Returns object array
````````php
$users = User::all();

Change log

Please check out CHANGELOG file for information on what has changed recently.

Contributing

Please check out CONTRIBUTING file for detailed contribution guidelines.

Credits

PersistenceManager is maintained by Verem Dugeri.

License

Persistence Manager is released under the MIT Licence. See the bundled LICENSE file for more details.