CodeIgniter Forums
Illuminate Database Wrapper - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Addins (https://forum.codeigniter.com/forumdisplay.php?fid=34)
+--- Thread: Illuminate Database Wrapper (/showthread.php?tid=79704)



Illuminate Database Wrapper - nfaiz - 07-21-2021

Hi,

This is my fun project for last weekend. But I've got time constraint to release due to eid celebration.

Illuminate Database Wrapper for CodeIgniter 4.

It uses CodeIgniter 4 debug toolbar to show the query collector for Illuminate Database.

You can use Illuminate Database features like
  • Query Builder
  • Schema Builder
  • Eloquent ORM

I am not Laravel developer, it just my colleague did ask me whether can use eloquent with CodeIgniter. So why not?

I cant explore much right now. Just reading a quick documentation here how to setup the library.

  1. Installation via composer
    Code:
    composer require nfaiz/dbtoolkit:dev-main

  2. Setup via spark
    Code:
    php spark dbtoolkit:publish

  3. Open app/Config/DbToolkit.php for library configuration.

  4. Basic usage (query builder)

    Use capsule() for db instance. Make sure DBgroup connection has been made.

    E.g for basic usage.

    In controller
    PHP Code:
    $user capsule()::table('users')->where('id'1)->get();
    $results capsule()::select('select * from users where id = ? or id = ?', [12]); 

    Debug toolbar
    [Image: 2MIxNp2.png]

Thank you.


RE: Illuminate Database Wrapper - kenjis - 12-11-2021

Thank you for sharing!


RE: Illuminate Database Wrapper - InsiteFX - 12-11-2021

Thank you for sharing this with the Community.


RE: Illuminate Database Wrapper - abmcr - 12-27-2021

Hello: thank you for share the code, but i have a problem in installation; Codeigniter 4.1.5 

PHP 7.4.25 (cli) (built: Oct 23 2021 18:05:05) ( NTS )
Copyright © The PHP Group
Zend Engine v3.4.0, Copyright © Zend Technologies
    with Zend OPcache v7.4.25, Copyright ©, by Zend Technologies


when i run       
php spark dbtoolkit:publish
i have this output


[email protected]:~/projects/ci4admlte/pro$ php spark dbtoolkit:publish

Fatal error: Uncaught Error: Class 'Nfaiz\DbToolkit\Config\Services' not found in /Users/andrea/projects/ci4admlte/pro/vendor/codeigniter4/framework/system/Config/BaseService.php:370
Stack trace:
#0 /Users/andrea/projects/ci4admlte/pro/vendor/codeigniter4/framework/system/Config/BaseService.php(257): CodeIgniter\Config\BaseService::buildServicesCache()
#1 /Users/andrea/projects/ci4admlte/pro/vendor/codeigniter4/framework/system/Config/BaseService.php(242): CodeIgniter\Config\BaseService:ConfusederviceExists('codeigniter')
#2 /Users/andrea/projects/ci4admlte/pro/vendor/codeigniter4/framework/system/bootstrap.php(145): CodeIgniter\Config\BaseService::__callStatic('codeigniter', Array)
#3 /Users/andrea/projects/ci4admlte/pro/spark(45): require('/Users/andrea/p...')
#4 {main}
  thrown in /Users/andrea/projects/ci4admlte/pro/vendor/codeigniter4/framework/system/Config/BaseService.php on line 370