We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

[Solved] How to use adapters?

Hello, how can I use adapters (for example Database adapter) like this: https://github.com/phalcon/incubator/tree/master/Library/Phalcon/Session/Adapter in my pure phalconphp 1.1.0? I have to compile incubator or what? I can't find any documentation or informations connected with it.



98.9k

The README explains how to do that, you need to set up an autoloader in your app that points to the incubator:

https://github.com/phalcon/incubator/blob/master/README.md#autoloading-from-the-incubator



1.0k

I did it. But a problem is still the same. Fatal error: Class 'Phalcon\Session\Adapter\Database' not found in C:\xampp\htdocs\phalconphp\invo-master\public\index.php on line 130 I put Library folder in to invo-master (C:\xampp\htdocs\phalconphp\invo-master\Library\Phalcon) and setup autoloader like this: 'Phalcon' => '/phalconphp/invo-master/Library/Phalcon/', but application still not able to find these classes



98.9k

Is /phalconphp/invo-master/Library/Phalcon/ a valid path in your system?



1.0k

Yep, because for example baseUri this works fine. baseUri = /phalconphp/invo-master/ In the other way this: 'Phalcon' => DIR . '/../Library/Phalcon/' does'nt work too. If for controllers everything works fine, so where is the problem?



43.9k

Hi, I use: 1/ in config: 'libraryDir' => DIR . '/../../app/library/', 2/ in public/index.php: $loader->registerDirs( array( $config->application->controllersDir, $config->application->modelsDir, $config->application->libraryDir ) ); and it's OK !



1.0k

Yes yes yes!!! It works. Thanks a lot!