PHPackages                             alexya-framework/database - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. alexya-framework/database

ActiveFramework[Framework](/categories/framework)

alexya-framework/database
=========================

Alexya's Database utilities

3.3.0(9y ago)01591GNUPHPPHP &gt;=7.0

Since Aug 25Pushed 9y ago1 watchersCompare

[ Source](https://github.com/AlexyaFramework/Database)[ Packagist](https://packagist.org/packages/alexya-framework/database)[ RSS](/packages/alexya-framework-database/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (8)Used By (1)

Database
========

[](#database)

Alexya's database components

Contents
--------

[](#contents)

- [Connection](#connection)
    - [Connecting to a database](#connecting_to_a_database)
    - [Executing queries](#executing_queries)
    - [Advanced Database Functions](#advanced_database_functions)
- [Query builder](#query_builder)
    - [Select queries](#select_queries)
    - [Insert queries](#insert_queries)
    - [Update queries](#update_queries)
    - [Delete queries](#delete_queries)
    - [`WHERE` Syntax](#where_syntax)
    - [Other SQL Functions](#other_sql_functions)
- [ORM](#orm)
    - [CRUD](#crud)
        - [Creating records](#creating_recors)
        - [Reading records](#reading_records)
        - [Updating records](#updating_records)
        - [Deleting records](#deleting_records)
    - [Relations](#relations)

Connection
------------------------------------------------

[](#connection)

The class `\Alexya\Database\Connection` provides an easy layer for connecting to a database and execute queries.

### Connecting to a database

[](#connecting-to-a-database)

To connect to a database you'll need to instance a `\Alexya\Database\Connection` object, the constructor accepts the following parameters:

- A string being server's host/ip
- An integer being server's port
- A string being database username
- A string being database password
- A string being database password

### Executing queries

[](#executing-queries)

The method `\Alexya\Database\Connection::execute` accepts as parameter a string that is the SQL query to execute:

```
