scrawler-labs / arca-orm

Low code , Zero Configuration ORM that creates models, config, database and tables on the fly.

Home Page:https://component.scrawlerlabs.com/arca-orm/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

๐Ÿš€ ARCA ORM

GitHub Workflow Status Codecov Scrutinizer code quality (GitHub/Bitbucket) Packagist Version (including pre-releases) GitHub License

๐Ÿ”ฅ Low code , Zero Configuration ORM that creates models, config, database and tables on the fly. ๐Ÿ”ฅ
๐Ÿ‡ฎ๐Ÿ‡ณ Made in India ๐Ÿ‡ฎ๐Ÿ‡ณ

arca-orm

Complete documentation can be found here



๐Ÿค” Why use Arca Orm ?

  • Automatically creates tables and columns as you go
  • No configuration, just fire and forget
  • Save loads of time while working on database
  • Built upon stable foundation of Doctrine Dbal and extensively tested
  • Thanks to loophp Arca comes with Lazy collection and tons of helper collection functions
  • Supports lots database platforms , you can see the complete list here
  • Supports concurrent queries and connection pooling with swoole and async with amphp. Check out integration docs here

โ—Requirements

  • PHP 8.1 or greater
  • PHP PDO or other supported database adapter
  • Mysql, MariaDB, Sqlite or any other supported database. check the list here

๐Ÿ’ป Installation

You can install Arca ORM via Composer. If you don't have composer installed , you can download composer from here

composer require scrawler/arca

๐Ÿ QuickStart

โœจ Setup

   <?php
    include './vendor/autoload.php'
    
    $connectionParams = array(
        'dbname' => 'YOUR_DB_NAME',
        'user' => 'YOUR_DB_USER',
        'password' => 'YOUR_DB_PASSWORD',
        'host' => 'YOUR_DB_HOST',
        'driver' => 'pdo_mysql', //You can use other supported driver this is the most basic mysql driver
    );

    // For Arca ORM 1.x
    // $db =  new \Scrawler\Arca\Database($connectionParams);
    
    // For Arca 2.x and later 
    $db = \Scrawler\Arca\Facade\Database::connect($connectionParams);
    

For complete list of driver check here

โœ๏ธ CRUD

    // Create new record
    // The below code will automatically create user table and store the record

    $user = $db->create('user');
    $user->name = "Pranja Pandey";
    $user->age = 24
    $user->gender = "male"
    $user->save()
    
    // Get record with id 1
    
    $user = $db->get('user',1);
    
    //Get all records
    
    $users = $db->get('user');
    
    // Update a record
     $user = $db->get('user',1);
     $user->name = "Mr Pranjal";
     $user->save();
     
    // Delete a record
     $user = $db->get('user',1);
     $user->delete();

For complete CRUD documentaion visit here

๐Ÿ”Ž Finding data with query

  // Using where clause
  $users = $db->find('user')
              ->where('name = "Pranjal Pandey"')
              ->get();
              
  foreach ($users as $user){
  // Some logic here 
  }
  
  // Get only single record
  $users = $db->find('user')
             ->where('name = "Pranjal Pandey"')
             ->first();  

  // Using limit in query
  $users = $db->find('user')
              ->setFirstResult(10)
              ->setMaxResults(20);
              ->get()

For complete Query documentaion visit here



๐Ÿ‘ Supporters

If you have reached here consider giving a star to help this project โค๏ธ Stargazers repo roster for @scrawler-labs/arca-orm

โœ… Roadmap

Here is list of few things that i would like to add in upcoming release

  • Models should be extendible with custom models
  • Validations for custom models
  • Automatically create migrations when table is updated or created
  • Support eager loading for relations
  • Better documentaions

๐Ÿ‘ Similar projects and inspiration

๐Ÿ“„ License

Arca ORM is created by Pranjal Pandey and released under the Apache 2.0 License.

About

Low code , Zero Configuration ORM that creates models, config, database and tables on the fly.

https://component.scrawlerlabs.com/arca-orm/

License:Apache License 2.0


Languages

Language:PHP 100.0%