EzDevInfo.com

eden

Eden PHP library Eden PHP Library eden takes advantage of php 5.3 with the tools available to get products made faster.

How to load eden with composer?

I want to write an application that uses parts of the mailer part of the eden library.

I have required it via composer.json:

 "require": {
    "eden/mail": "^1.0",
    ...

It seems though that the library isn't autloaded properly, as the call to the eden via eden('mail')->smtp(...) function leads to:

PHP Fatal error:  Call to undefined function Kopernikus\MassMailer\Service\eden() in ~/src/massmailer/src/Kopernikus/MassMailer/Service/EdenMailerFactory.php on line 20

The quick setup guides only handles the case for the one-file approach via:

include('eden.php');
eden('debug')->output('Hello World'); //--> Hello World

I don't want to add a huge libary file and include it manually. The autoloading seems to works fine, I just have to use the class directly instead of going with the eden() function:

 use Eden\Mail\Smtp;

 YourClass
 {
     $smtp = new Smtp(
         $host, 
         $user, 
         $pass, 
         $port = NULL, 
         $ssl = false, 
         $tls = false
     );
 }

The autoloading seems to works fine basically, as I can use the class directly instead of going with the eden() function:

 use Eden\Mail\Smtp;

 YourClass
 {
     ...
     $smtp = new Smtp(
         $host, 
         $user, 
         $pass, 
         $port, 
         $ssl, 
         $tls
     );
 }

Yet then I get weird errors like when trying to send a mail.

[Eden\Core\Exception]                                                             
  Both Physical and Virtual method Eden\Mail\Smtp->_getPlainBody() 

I want to go the composer route.

It seems I have to include a file via include-path option or add someting to the autoload, yet I am unsure.

How to load eden mailer component the composer way?


Source: (StackOverflow)