Welcome Guest, Not a member yet? Register   Sign In
Illuminate Database Wrapper
#1

(This post was last modified: 07-25-2021, 04:37 PM by nfaiz.)

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.
Reply
#2

Thank you for sharing!
Reply
#3

Thank you for sharing this with the Community.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

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


andrea@MacBook-Pro-ABERSI:~/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
Reply




Theme © iAndrew 2016 - Forum software by © MyBB