Lack of composer support
Closed this issue · 16 comments
I think you should add composer support and one of PSR standards for autoloading.
+1 The "require" method to load the php class is very old school now. PHP community uses namespaces since PHP 5.3, and most open source libraries are now included using composer + packagist.org. It would help us a lot !
If you need help with that, just let me know, I would be glad to make a pull request. Could you just create an account on packagist.org and tell me the vendor name choosen (sendinblue or mailin ?)
@JMLamodiere we created account on packagist.org with username sendinblue
So Will there be a composer support or should I look for a different mail provider?
@lokeshguptasldt Sorry I don't use this API anymore, and I had completely forgotten this issue. Could you take care of this ?
@Majstr @JMLamodiere yes we are working on this and will update shortly.
@Majstr @JMLamodiere Composer support is now available https://packagist.org/packages/mailin-api/mailin-api-php
Please let us know, if you face any issue.
Not working. I thing the problem is in namespace. There is no namespace and you have 2 same files for V1 and V2.
@Majstr we are checking asap
@Majstr please try again. You should be able to use V2.0 api via composer.
Noup. I get error "Class 'SendinBlue\Mailin' not found ".
Problems might be in:
- file name is not the same as class
- wrong path for composer (autoload setting) -> my other vendors have paths set different
- 'throw new Exception('Mailin requires CURL module');' -> 'throw new \Exception('Mailin requires CURL module');'
To follow the PSR-0 standard, the file mailin.php should be in a subfolder /mailin-api/mailin-api-php/V2.0/SendinBlue/. Then we'll not get the error: "Class 'SendinBlue\Mailin' not found "
Now it's seem to work. Just fix 'Exception' to '\Exception'.
It should work now. Please check.
"Class 'SendinBlue\Mailin' not found"
using Yii2 framework. Not a lot of experience with Yii2 yet, but every other composer package has installed ok.
I used:
composer require mailin-api/mailin-api-php dev-master
Now I am just guessing why this error occurs. All of these fail the same way.
// SendinBlue
'mailin' => [
'class' => 'mailin-api\Sendinblue\Mailer',
//'class'=>'vendor/mailin-api/mailin-api-php/src/Sendinblue/Mailin.php',
//'class'=>'Sendinblue\Mailin'
],
My phpStorm IDE gives no clues, the namespaces seem to be okay.
But runtime blows up.
I don't suppose this is your problem, but if anyone can suggest how to get going...
RESOLVED: The problem was... I had typed: use SendinBlue\Mailin;
I like CamelCase and SendinBlue uses it all over the place.
But it does not work for auto loaders under unix. Must match case.
The correct line is: use Sendinblue\Mailin;
Hello @HankBrown
Please refer here https://github.com/mailin-api/mailin-api-php/blob/master/src/Sendinblue/README.md for installation & quick start.
Hope the sample script helps you!
Thank you
I have the same issue, no namespace defined so I get Class 'Sendinblue\Mailin' not found