dripemail / drip-php Goto Github PK
View Code? Open in Web Editor NEWAn object-oriented PHP wrapper for Drip's API
License: MIT License
An object-oriented PHP wrapper for Drip's API
License: MIT License
As the method name suggests, it should be able to update an existing subscriber using this method. However, the API returns a uniqueness_error
with message User is already being used
when I try to update a subscriber. Any clues?
Can you please kindly tell me how can i get the API Token for my app.
We have a working Drip integration, but were looking to switch to the official library. But the way authentication happens does not work for us (we get authentication errors). However if switch to using the Bearer authorization token header, things work as expected. E.g.
...
$client = new \GuzzleHttp\Client();
$req_params = [
'base_uri' => $this->api_end_point,
'handler' => $stack,
'timeout' => $this->timeout,
'connect_timeout' => $this->connect_timeout,
'http_errors' => false,
'headers' => array(
'User-Agent' => $this->user_agent(),
'Accept' => 'application/json, text/javascript, */*; q=0.01',
'Content-Type' => 'application/vnd.api+json',
'Authorization' => 'Bearer ' . $this->api_token,
),
];
... switch case statement ...
$res = $client->request($req_method, $url, $req_params);
No matter what method I run it all returns the not_found_error from the client despite my api key and account id is valid. I tried on my server, my localhost as well run a phpunit. All returns the same result. Please help.
I had some issues with content-type.
now it is set to:
$req_params = [
'timeout' => $this->timeout,
'connect_timeout' => $this->connect_timeout,
'headers' => [
'User-Agent' => $this->user_agent(),
'Accept' => 'application/json, text/javascript, */*; q=0.01',
'Content-Type' => 'application/vnd.api+json',
],
'http_errors' => false,
];
When I changed it to 'Content-Type' => 'application/json',
everything is fine.
Could you please check this?
My Error was:
array(1) {
["message"]=>
string(22) "Unsupported Media Type"
}
fetch_subscriber_campaigns
is available in the API but not in the PHP wrapper.
We've added this one, we were going to subclass it (hence #16 ) but upon internal discussion, it's not specific to us and everyone can benefit so we'll PR it in here.
PR to follow when I can get a minute :)
For those who don't have access to a command line (like most of us who have hosted web plans) installation via Composer is out of reach.
This library is useless for me.
I see there hasn't been any recent activity for this repository. Just a few stale PRs and a couple of issues that haven't been responded to. However, the Ruby and NodeJS wrappers have been fairly active within the last few weeks.
On that note, it seems this package is a little out of date with modern PHP practices/standards. It's not even available via Composer/Packagist. Are there any plans on modernizing the code base and doing a proper release for Composer?
I'd love to improve the documentation for this โ adding usage examples in the README, for instance.
Leaving this as a placeholder for now; I'll hopefully be able to do some of this in the coming days/weeks/whatever, but anyone else, feel free to open a PR with any documentation improvements.
We need to add methods to class \Drip\Client
so we were looking at extending it with our custom class, adding the functionality that we need (and use that in our uses rather than the base class).
But many properties and attributes in Drip\Client
are private
; I don't see why they couldn't be protected
instead? That would make it possible for others (like us) to extend it.
I'm using this library on a nearlyfreespeech.net server and it's complaining about the CURLOPT_FOLLOWLOCATION not being allowed with an open base dir. (Basically this: http://stackoverflow.com/questions/2511410/curl-follow-location-error).
NearlyFreeSpeech don't give a "full server" so to speak and their systems are kinda locked down which is where I presume is the cause of the error. On a virtual server box at home it works fine.
I've disabled the option on my server by commenting out that line and the error's gone and it seems to be working but I'm just using one api method (create_or_update_subscriber).
Wondering if there's a more subtle problem and whether this flag is actually necessary.
I'm struggling to use the library with php 7.4.x, as composer seems to think it needs 8.2 to run.
Is there a way to force it to use 7.4 for this composer.json, so that the Autoload script will run on my server with 7.4.29?
As of now, this project supports up to PHP 7.2... which is abandoned.
It would be nice to be able to use PHP 8.x.
Is possible register package in Packagist?
For now on Packagist are only unofficial packages - https://packagist.org/?query=drip%20php
When you want I can help you. Simle manual how add package:
That's it, the library is available on Packagist
First off, excellent wrapper. Very easy to use and well-written.
I already wrote something that should do this - would love to make a PR if you are ok with it:
/**
* Fetch a campaign for the given account.
* @param array
* @return array
*/
public function fetch_campaign($params) {
if (empty($params['account_id'])) {
throw new Exception("Account ID not specified");
}
$account_id = $params['account_id'];
unset($params['account_id']); // clear it from the params
if (!empty($params['campaign_id'])) {
$campaign_id = $params['campaign_id'];
unset($params['campaign_id']); // clear it from the params
} else {
throw new Exception("Campaign ID was not specified. You must specify a Campaign ID");
}
$url = $this->api_end_point . "$account_id/campaigns/$campaign_id";
$res = $this->make_request($url, $params);
if (!empty($res['buffer'])) {
$raw_json = json_decode($res['buffer'], true);
}
// here we distinguish errors from no campaigns.
// when there's no json that's an error
$campaigns = empty($raw_json)
? false
: empty($raw_json['campaigns'])
? array()
: $raw_json['campaigns'];
return $campaigns;
}
Hey guys!
I just added this package to Packagist. Would you mind tagging a release here, to indicate a stable version? This is needed for people to install the package.
Thanks!
Can you provide some license information for this Repo? I want to use this code for commercial use.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.