-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename Configuration.php to ApiClient.php #2
Conversation
composer autoload can't find the class otherwise
Does something need to be done to specify a stable release for Composer?
|
@mc2 "minimum-stability": "dev",
"prefer-stable" : true, like this, and it works. {
"minimum-stability": "dev",
"prefer-stable" : true,
"require": {
"mailchimp/transactional": "*",
"mailchimp/marketing": "dev-master",
}
} |
$ composer require mailchimp/marketing:dev-master |
thanks all! |
If you want a stable version you have to tag a commit sematically e.g. 1.0.0 Composer will then determin the latest possible version for your stability requirements. e.g. composer require mailchimp/marketing:1.1.1 will not match 1.0.0 |
Hello, I pulled your branch to try to fix my bug, but I still got trouble, I'm using CodeIgniter framework with composer autoloader. use MailchimpMarketing\ApiClient;
class Auth extends CI_Controller
{
public function test()
{
$mailchimp = new MailchimpMarketing\ApiClient();
$mailchimp->setConfig([
'apiKey' => 'xxxxxxxxxxxxxxxxxxxxxx-us17',
'server' => 'us17'
]);
$response = $mailchimp->ping->get();
print_r($response);
}
} Thanks in advance |
Any update on this? I can’t use this package because the filename doesn’t match the class name. It’s also disappointing there seems to be no tagging going on this repository. That would be tremendously helpful when installing this package via Composer, too. |
You could use https://github.com/cweagans/composer-patches in the meantime. That’s quite useful for situations like this. Rico |
I’ve just forked the package and made the one-line change myself. I wasn’t impeded by installing the library through other methods, but just curious as to why such a trivial change has been left unmerged for nearly a month now? |
There is a line in the composer.json file that should do a copy of the Configuration.php file to ApiClient.php however this doesn't appear to be working for a lot of people. The original developer probably did it this way for a reason.
|
that makes no sense at all to me 😄 but good find! |
Yes it doesn't make sense to me either but a thought maybe that there is a central codebase for their API code that in turn churns it out to all the programming languages including PHP, Ruby etc. I guess we will have to await for the original developer to do something here. |
Just worked out as a sticky plaster fix for everyone here if you add the following to your projects composer.json file this will work.
This fix will also work when I commit for other developers and our automated deployment system as its reading from the composer file. |
As mentioned in the composer doc :
IMHO, renaming the file to ApiClient.php to stick to the PSR-4 standard is the right thing to do, but if for any reason they must keep this name, composer has a special autoload option : classmap which allow file name and class name to be different. I you want people to use your official library, please make it work ;) |
💯 |
Can we get this merged if possible?:) |
After changing the filename I was greeted with another error. Parse error: syntax error, unexpected 'list' (T_LIST), expecting identifier (T_STRING) in /vendor/mailchimp/marketing/lib/Api/AuthorizedAppsApi.php on line 65 I'm not a full time PHP developer but it seems that "list" is a reserved word and should not be used as a function... |
You broke something in AuthorizedAppsApi.php in Line 64 ... that’s not caused by the rename. |
Really weird that it is my fault because I did not change anything besides the filename :) |
I’d guess at least php7 - we’re using it with 7.2 and 7.4 |
I have tweeted the maintainer of this project and asked what is supposed to happen with this library. Currently the getting started code does not work. |
Come on. Are you telling me a company with the budget and number of engineers that Mailchimp has, can’t spend an hour fixing a library for using their product? 😩 |
I am running PHP 5.6, and I am facing this error too. With this error, this is unusable. Will be great if the MailChimp could rectify it as soon as possible. based on https://www.php.net/manual/en/reserved.keywords.php, list() is a reserved keyword |
Hey all, sorry for the delays here; the new version pushed on Friday should address this issue (I just tested it on my machine from a clean install). Let me know if you see any more problems and, again, apologies for the delays. |
One other thing: this SDKs (and the SDKs for other languages) are generated from a codegen repo here: https://github.com/mailchimp/mailchimp-client-lib-codegen We won't accept PRs on this repo (though we will use them to inform bug fixes) because they'll be overridden by the automated codegen. If you have improvements to the SDKs, the codegen repo is the place for PRs. Thanks again for your patience / apologies it took so long. |
composer require mailchimp/marketing:dev-master i'm using this to install the library. |
@mc2 This problem has been fixed in the latest release (3.0.22): the version is now properly tagged in the repo, allowing Packagist/Composer to pick it up. So running
and there is no need to mess with As for this issue's original problem, it has also been fixed a couple weeks ago as mentioned by @Moishe, so I think this discussion can be closed. |
Just installed |
Gonna close this, because it should be resolved now. In the future please make PRs on the mailchimp-client-codegen repo (and we'll try to respond to them more quickly) |
composer autoload can't find the class otherwise