Download the PHP package voku/simple-active-record without Composer

On this page you can find all versions of the php package voku/simple-active-record. 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 simple-active-record

Build Status Coverage Status Codacy Badge Latest Stable Version Total Downloads License Donate to this project using Paypal Donate to this project using Patreon

:ring: Simple Active Record

This is a simple Active Record Pattern compatible with PHP 7+ that provides a simple and secure interaction with your database using :gem: "Simple MySQLi" at its core. This is perfect for small scale applications such as cron jobs, facebook canvas campaigns or micro frameworks or sites.

Get "Simple Active Record"

You can download it from here, or require it using composer.

Install via "composer require"

Starting the driver

Multiton && Singleton

You can use without any parameters and you will get your (as "singleton") first initialized connection. Or you can change the parameter and you will create an new "multiton"-instance which works like an singleton, but you need to use the same parameters again, otherwise (without the same parameter) you will get an new instance.

Doctrine/DBAL as parent driver

Using the "ActiveRecord"-Class (OOP database-access)

A simple implement of active record pattern via Arrayy.

setDb(DB $db)

set the DB connection.

insert() : bool|int

This function can build insert SQL queries and can insert the current record into database. If insert was successful, it will return the new id, otherwise it will return false or true (if there are no dirty data).

fetch(integer $id = null) : bool|\ActiveRecord

This function can fetch one record and assign in to current object. If you call this function with the $id parameter, it will fetch records by using the current primary-key-name.

fetchAll() : $this[]

This function can fetch all records in the database and will return an array of ActiveRecord objects.

update() : bool|int

This function can build update SQL queries and can update the current record in database, just write the dirty data into database. If update was successful, it will return the affected rows as int, otherwise it will return false or true (if there are no dirty data).

delete() : bool

This function can delete the current record in the database.

Active Record | SQL part functions

select()

This function can set the select columns.

from()

This function can set the table to fetch record from.

join()

This function can set the table to fetch record from.

where()

This function can set where conditions.

groupBy()

This function can set the "group by" conditions.

orderBy()

This function can set the "order by" conditions.

limit()

This function can set the "limit" conditions.

Active Record | WHERE conditions

equal()/eq()

notEqual()/ne()

greaterThan()/gt()

lessThan()/lt()

greaterThanOrEqual()/ge()/gte()

lessThanOrEqual()/le()/lte()

like()

in()

notIn()

isNull()

isNotNull()/notNull()

Active Record | Demo

Include && Init

Define Class

Init data (for testing - use migrations for this step, please)

Insert one User into database.

Insert one Contact belongs the current user.

Example to using relations

Changelog

See CHANGELOG.md.

Support

For support and donations please visit Github | Issues | PayPal | Patreon.

For status updates and release announcements please visit Releases | Twitter | Patreon.

For professional support please contact me.

Thanks


All versions of simple-active-record with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
voku/arrayy Version ~7.0
voku/simple-mysqli Version ~8.0
hashids/hashids Version ~2.0 || ~3.0 || ~4.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 voku/simple-active-record contains the following files

Loading the files please wait ....