Skip to content

A fast, secure, and easy modern SQL library for PHP. supporting multiple database types: MySQL, PostgreSQL, SQLite, Sybase, Oracle, and MSSQL.

License

Notifications You must be signed in to change notification settings

code3-dev/FoxQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦊 FoxQL

PHP Version License: MIT Composer Package GitHub

A fast, secure, and easy modern SQL library for PHP

Seamlessly work with PostgreSQL, MySQL, SQLite, Sybase, Oracle, and MSSQL databases


✨ Features

  • 🚀 Simple & Intuitive API - Write less, do more with a clean, fluent interface
  • 🔒 Secure by Default - Built-in protection against SQL injection
  • 🔄 Multi-Database Support - Works with PostgreSQL, MySQL, SQLite, Sybase, Oracle, and MSSQL
  • 🧩 Modular Design - Use only what you need with a lightweight core
  • 📊 Powerful Query Builder - Construct complex queries with ease
  • 🛠️ Schema Management - Create and modify database structures programmatically
  • 🏗️ Migration System - Laravel-inspired migrations for managing database schema changes

📦 Installation

Using Composer (Recommended)

composer require foxql/foxql

🚀 Quick Start

// Create a new FoxQL instance with MySQL connection
try {
    $db = new \FoxQL\FoxQL([
        'type' => 'mysql',        // Database type: mysql, pgsql, sqlite, etc.
        'database' => 'my_database',
        'host' => 'localhost',
        'username' => 'root',
        'password' => 'password',
        'charset' => 'utf8mb4',   // Character set
        'prefix' => 'prefix_'      // Table prefix (optional)
    ]);
    
    // Insert data
    $db->insert('users', [
        'name' => 'John Doe',
        'email' => '[email protected]'
    ]);
    
    // Select data
    $users = $db->select('users', '*');
    print_r($users);
    
} catch (\PDOException $e) {
    echo "Connection failed: " . $e->getMessage();
}

🏗️ Database Migrations

FoxQL includes a powerful migration system for managing database schema changes:

// Create a table using the migration builder
$db->createTable('users', function($table) {
    $table->increments('id');
    $table->string('name', 100)->notNull();
    $table->string('email', 100)->notNull()->unique();
    $table->timestamps(); // Adds created_at and updated_at columns
});

// Run migrations from a directory
$migrations = $db->migrate('/path/to/migrations');

// See the complete example in examples/migration_example.php

📚 Documentation

Explore our comprehensive documentation for detailed usage instructions:

🔄 Core Operations

Basic Operations Data Manipulation Schema Management Raw SQL
Connection Insert Create Table Query
Select Update Drop Table Execute
Get Delete Action
Has Replace Migration

📊 Aggregation Functions

Statistical Mathematical Other
Count Sum Rand
Average Max
Min

📄 License

FoxQL is open-sourced software licensed under the MIT license.

👨‍💻 Developer

About

A fast, secure, and easy modern SQL library for PHP. supporting multiple database types: MySQL, PostgreSQL, SQLite, Sybase, Oracle, and MSSQL.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages