Download the PHP package adaiasmagdiel/rubik without Composer

On this page you can find all versions of the php package adaiasmagdiel/rubik. 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 rubik

Rubik ORM

Rubik ORM is a lightweight and intuitive Object-Relational Mapping (ORM) library designed for SQLite and MySQL/MariaDB databases. Inspired by the simplicity and structure of a Rubik's Cube, Rubik provides a clean and efficient way to interact with databases using both Active Record and Query Builder patterns. It offers robust support for CRUD operations, relationships, and schema management while maintaining a minimal footprint.

Table of Contents

Features

Use Cases

Rubik ORM is ideal for:

Installation

Prerequisites

Install via Composer

Run the following command to install Rubik ORM:

Alternatively, add the following to your composer.json and run composer update:

Getting Started

Follow these steps to start using Rubik ORM in your project:

  1. Set Up the Database Connection: Configure and establish a connection using the Rubik class. For SQLite, specify a file path or use :memory: for an in-memory database. For MySQL/MariaDB, provide host, database, and credentials.

  2. Define a Model: Create a model by extending the Model class and defining the table schema in the fields() method.

  3. Create the Table: Use the createTable method to generate the database table based on the model's schema.

  4. Perform CRUD Operations: Use Active Record methods to interact with the database.

Basic Examples

Creating a Record

Retrieving Records

Updating a Record

Deleting a Record

Advanced Examples

Query Builder

The Query Builder allows you to construct complex queries fluently.

Relationships

Define relationships between models using belongsTo and hasMany.

Bulk Insert

Insert multiple records efficiently using insertMany.

SQLite and MySQL Examples

SQLite Example

Using an in-memory SQLite database for testing:

MySQL/MariaDB Example

Using a MySQL database for a web application:

Models and Active Records

Defining Models

Models represent database tables and are defined by extending the Model class. The fields() method specifies the table schema using field types from FieldEnum (e.g., INTEGER, TEXT, REAL).

Active Record Operations

The Active Record pattern allows you to manipulate records as objects:

Example:

Query Builder

The Query Builder provides a fluent interface for constructing SQL queries. It supports:

Example:

Or paginate results:

Relationships

Rubik ORM supports belongsTo and hasMany relationships, allowing you to model one-to-one and one-to-many associations.

BelongsTo

A model can belong to another model via a foreign key.

HasMany

A model can have multiple related models.

Using Relationships

Access related data dynamically:

API Reference

Class: FieldEnum

An enumeration defining SQLite and MySQL/MariaDB field data types.

Class: Rubik

Main entry point for managing database connections.

Class: Model (Abstract)

Abstract base class for database models, implementing Active Record pattern.

Class: Query

Query builder for constructing and executing SQL queries.

Class: Relationship

Represents relationships between models (belongsTo and hasMany).

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/your-feature).
  3. Commit your changes (git commit -m 'Add your feature').
  4. Push to the branch (git push origin feature/your-feature).
  5. Open a Pull Request.

Please include tests and update the documentation as needed.

License

Rubik ORM is licensed under the GNU General Public License v3.0 (GPL-3.0).
See the COPYRIGHT files for details.


All versions of rubik with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 adaiasmagdiel/rubik contains the following files

Loading the files please wait ...