Download the PHP package bephp/activerecord without Composer

On this page you can find all versions of the php package bephp/activerecord. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package activerecord

activerecord

Build Status Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License

micro activerecord library in PHP(only 400 lines with comments), support chain calls and relations(HAS_ONE, HAS_MANY, BELONGS_TO).

中文版.

Documentation

Documentation

API Reference

CRUD functions

setDb(\PDO $db)

set the DB connection.

ActiveRecord::setDb(new PDO('sqlite:test.db'));

insert() : boolean|\ActiveRecord

function to build insert SQL, and insert current record into database. if insert success return current object, other wise return false.

$user = new User();
$user->name = 'demo';
$user->password = md5('demo');
$user->insert();

find(integer $id = null) : boolean|\ActiveRecord

function to find one record and assign in to current object. If call this function using $id param, will find record by using this id. If not set, just find the first record in database. if find record, assign in to current object and return it, other wise return "false".

$user->notnull('id')->orderby('id desc')->find();

findAll() : array

function to find all records in database. return array of ActiveRecord

$user->findAll();

update() : boolean|\ActiveRecord

function to build update SQL, and update current record in database, just write the dirty data into database. if update success return current object, other wise return false.

$user->notnull('id')->orderby('id desc')->find();
$user->email = '[email protected]';
$user->update();

delete() : boolean

function to delete current record in database.

reset() : \ActiveRecord

function to reset the $params and $sqlExpressions. return $this, can using chain method calls.

dirty(array $dirty = array()) : \ActiveRecord

function to SET or RESET the dirty data. The dirty data will be set, or empty array to reset the dirty data.

SQL part functions

select()

function to set the select columns.

$user->select('id', 'name')->find();

from()

function to set the table to find record

$user->select('id', 'name')->from('user')->find();

join()

function to set the table to find record

$user->join('contact', 'contact.user_id = user.id')->find();

where()

function to set where conditions

$user->where('id=1 AND name="demo"')->find();

group()/groupby()

$user->select('count(1) as count')->groupby('name')->findAll();

order()/orderby()

$user->orderby('name DESC')->find();

limit()

$user->orderby('name DESC')->limit(0, 1)->find();

WHERE conditions

equal()/eq()

$user->eq('id', 1)->find();

notequal()/ne()

$user->ne('id', 1)->find();

greaterthan()/gt()

$user->gt('id', 1)->find();

lessthan()/lt()

$user->lt('id', 1)->find();

greaterthanorequal()/ge()/gte()

$user->ge('id', 1)->find();

lessthanorequal()/le()/lte()

$user->le('id', 1)->find();

like()

$user->like('name', 'de')->find();

in()

$user->in('id', [1, 2])->find();

notin()

$user->notin('id', [1,3])->find();

isnull()

$user->isnull('id')->find();

isnotnull()/notnull()

$user->isnotnull('id')->find();

Install

composer require bephp/activerecord 

There's one Blog demo, work with Router and MicoTpl.

Demo

Include base class ActiveRecord

Define Class

Init data

Insert one User into database.

Insert one Contact belongs the current user.

Example to using relations


All versions of activerecord with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bephp/activerecord contains the following files

Loading the files please wait ....