Download the PHP package wnikk/micro-active-record without Composer

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

MicroActiveRecord PDO for PHP

Dependents

A minimal, dependency - free ActiveRecord implementation for PHP using PDO. Designed for rapid development, security, and maximum portability - just drop in a single file and start working with your database safely and efficiently.

Why MicroActiveRecord?

Supported Databases and DSN Examples

Note: For MSSQL and Oracle, the appropriate PDO driver must be installed and enabled in your PHP environment.

Getting Started

  1. Copy the ActiveRecord.php and DbConn.php files (and optionally Model.php and ModelCollection.php) into your project.
  2. Create and inject your PDO connection:

Installation with Composer (optional)

You do not need Composer for minimal usage - just copy the files as described above. However, if you prefer to use Composer for dependency management and autoloading, you can install MicroActiveRecord as a package:

Composer will handle autoloading for you, so you can use the classes directly in your project.

Usage Examples

Optional: Set PDO connection multi connections (using DbConn class)

Basic Select (without DbConn only ActiveRecord+PDO)

Select with class for table

Insert

Update

Update with class for table

Delete

Complex Query

Call Raw Query

Get Raw SQL

Logging Queries

Add join with alias and select specific fields

Security and Data Safety

Error Handling and Diagnostics

ActiveRecord provides advanced error handling and diagnostics for robust application development:

Example:

This makes it easy to build user-friendly APIs or admin panels where you want to handle errors gracefully without interrupting the application flow.

API Reference

Query Builder Methods

All methods are chainable and can be called statically (e.g., ActiveRecord::table(...)->where(...)) or on an instance.

Execution Methods

Utility Methods

Advanced Usage

Custom Models

You can extend ActiveRecord or Model to add business logic, validation, or computed properties:

Using with Different Databases

Just change the DSN in your config or inject a different PDO. All features work with MySQL, MariaDB, SQLite, PostgreSQL, MSSQL (sqlsrv/dblib), and Oracle (oci).

Schema Definition

You can define columns and types in your model for stricter validation:

FAQ

Q: Can I use this in production?
A: Yes! It is designed for safety and performance. All queries are parameterized and types are checked.

Q: What if I need more features?
A: You can extend the base class or add your own methods. The code is simple and well-documented.

Q: Is it compatible with frameworks?
A: Yes, but it is designed to be framework-agnostic. You can use it anywhere PHP and PDO are available.


All versions of micro-active-record with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-pdo Version *
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 wnikk/micro-active-record contains the following files

Loading the files please wait ...