Coder Social home page Coder Social logo

drip-php's People

Contributors

alexdunne avatar aramboyajyan avatar bcmcq avatar bryceadams avatar derrickreimer avatar hannesvdvreken avatar jay-ua avatar mticciati avatar polevaultweb avatar rwalling avatar szepeviktor avatar tiannaavery avatar will-in-wi avatar wjohnstondrip avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drip-php's Issues

Is there a reason the Bearer authorization header is not used?

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); 

The resource you requested was not found

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.

415 error - Unsupported Media Type

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"
  }

Add fetch_subscriber_campaigns

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 :)

Manual installation (Without composer)

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.

Is this package still maintained?

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?

Improve documentation

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.

Make properties, method protected rather than private

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.

Issue with CURLOPT_FOLLOWLOCATION

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.

Working with Composer on php 7.4.x

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?

Support for PHP 8.0 ?

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.

Add fetch_campaign method

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;
    }

License missing

Can you provide some license information for this Repo? I want to use this code for commercial use.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.