xsanisty / SlimBoard

Starter Application built on Slim Framework in MVC (and HMVC) environment
http://www.xsanisty.com/project/slim-starter
MIT License
288 stars 71 forks source link

Multiple database connections #1

Closed nasaorc closed 10 years ago

nasaorc commented 10 years ago

Can you update for connecting multiple database like Laravel please? Thanks

ikhsan017 commented 10 years ago

based on eloquent config, it should be possible

will try to test it this weekend

nasaorc commented 10 years ago

Thanks. Another request, could you try to implements Laravel session into this application? Seems php session isn't good for production and slim session use cookies which had size limit. Cheers.

ikhsan017 commented 10 years ago

I am trying to keep core of SlimStarter as small as possible, but I saw laravel session component depend on many package, I'll try to build custom solution for handling session, with small footprint as possible as it currently ~4mb without public assets

nasaorc commented 10 years ago

Great, wait for your impressive update!

On Thu, Apr 17, 2014 at 8:22 AM, Ikhsan Agustian notifications@github.com wrote:

I am trying to keep core of SlimStarter as small as possible, but I saw laravel session component depend on many package, I'll try to build custom solution for handling session, with small footprint as possible as it currently ~4mb without public assets

Reply to this email directly or view it on GitHub: https://github.com/ikhsan017/SlimStarter/issues/1#issuecomment-40668223

ikhsan017 commented 10 years ago

It's now able to configure it with multiple connection type

to use different connection for read and write, I thought it should be no problem since it use Laravel's eloquent

copied from the laravel's docs

'mysql' => array(
    'read' => array(
        'host' => '192.168.1.1',
    ),
    'write' => array(
        'host' => '196.168.1.2'
    ),
    'driver'    => 'mysql',
    'database'  => 'database',
    'username'  => 'root',
    'password'  => '',
    'charset'   => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix'    => '',
),
nasaorc commented 10 years ago

No, i don't mean r/w connection. I mean $connection = 'sqlite'; in eloquent model and different database connection in config file.

ikhsan017 commented 10 years ago

it's already there :)

https://github.com/xsanisty/SlimStarter/blob/master/app/config/database.php

nasaorc commented 10 years ago

oh thanks a lot!!

On Wed, May 14, 2014 at 10:32 PM, Ikhsan Agustian notifications@github.comwrote:

it's already there :)

https://github.com/xsanisty/SlimStarter/blob/master/app/config/database.php

— Reply to this email directly or view it on GitHubhttps://github.com/xsanisty/SlimStarter/issues/1#issuecomment-43087903 .

nasaorc commented 10 years ago

if i want yo load my custom library, is it i just add something like "app/library" into composer.json "psr-4", then add the namespace alias in config.php?

ikhsan017 commented 10 years ago

since it use composer, yup you can do that. The alias in config/alias.php is specified for "facade" class

if you add app/library into psr-4 loader, the namespace is registered automatically when you run composer update or composer dump-autoload

You can call SomeClass in app/library/SomeNameSpace/SomeClass.php by calling

new \SomeNameSpace\SomeClass();

and autoloader will call app/library/SomeNameSpace/SomeClass.php automatically

nasaorc commented 10 years ago

Thank you for explanation, will try it tonight!

On Thu, May 15, 2014 at 12:33 AM, Ikhsan Agustian notifications@github.com wrote:

since it use composer, yup you can do that. The alias in config/alias.php is specified for "facade" class if you add app/library into psr-4 loader, the namespace is registered automatically when you run composer update or composer dump-autoload You can call SomeClass in app/library/SomeNameSpace/SomeClass.php by calling

new \SomeNameSpace\SomeClass();

and autoloader will call app/library/SomeNameSpace/SomeClass.php automatically

Reply to this email directly or view it on GitHub: https://github.com/xsanisty/SlimStarter/issues/1#issuecomment-43104443

nasaorc commented 10 years ago

Where should I put the Sentry config file just like Laravel's /config/packages/cartalyst/sentry

ikhsan017 commented 10 years ago

It is not implemented yet, I will try to create sentry configuration in app/config/sentry.php

nasaorc commented 10 years ago

oh i see, can you also update sentry to 3.0 too? many thanks!

On Thu, May 15, 2014 at 5:17 PM, Ikhsan Agustian notifications@github.comwrote:

It is not implemented yet, I will try to create sentry configuration in app/config/sentry.php

— Reply to this email directly or view it on GitHubhttps://github.com/xsanisty/SlimStarter/issues/1#issuecomment-43186463 .

ikhsan017 commented 10 years ago

3.0 is currently in beta, will wait till cartalyst release the stable version

ikhsan017 commented 10 years ago

by the way, cartalyst sentry configuration is now remain in app/config/sentry.php

you can configure it there, also please don't hesitate to raise an issue if something when bug found, as I am not quiet proficient in unit testing :D, also can not try all possible configuration

nasaorc commented 10 years ago

Ok thanks!

On Tue, May 20, 2014 at 9:33 AM, Ikhsan Agustian notifications@github.com wrote:

by the way, cartalyst sentry configuration is now remain in app/config/sentry.php

you can configure it there, also please don't hesitate to raise an issue if something when bug found, as I am not quiet proficient in unit testing :D, also can not try all possible configuration

Reply to this email directly or view it on GitHub: https://github.com/xsanisty/SlimStarter/issues/1#issuecomment-43577862