Download the PHP package chartmogul/chartmogul-php without Composer
On this page you can find all versions of the php package chartmogul/chartmogul-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package chartmogul-php
Official ChartMogul API PHP Client
chartmogul-php
provides convenient PHP bindings for ChartMogul's API.
Installation | Configuration | Usage | Development | Contributing | License
Installation
This library requires php 5.5 or above.
For older php versions (< 7.4
) use 1.x.x
releases of this library.
For php version >=7.4
use the latest releases (5.x.x
) of the library
The library doesn't depend on any concrete HTTP client libraries. Follow the instructions here to find out how to include a HTTP client.
Here's an example with Guzzle HTTP client
:
Configuration
Setup the default configuration with your ChartMogul api key:
Test your authentication
Usage
All array results are wrapped with Doctrine\Common\Collections\ArrayCollection
for ease of access. See Exceptions for a list of exceptions thrown by this library.
Available methods in Import API:
Data Sources
Create Datasources
Get a Datasource
List Datasources
Delete a Datasource
Customers
Import a Customer
List Customers
Find Customer By External ID
Delete A Customer
Get a Customer
Search for Customers
Merge Customers
Unmerge Customers
Update a Customer
Connect Subscriptions
OR
Customer Attributes
Retrieve Customer's Attributes
Tags
Add Tags to a Customer
Add Tags to Customers with email
Remove Tags from a Customer
Custom Attributes
Add Custom Attributes to a Customer
Add Custom Attributes to Customers with email
Update Custom Attributes of a Customer
Remove Custom Attributes from a Customer
List Contacts from a customer
Create a Contact from a customer
List Customer Notes from a customer
Create a Customer Note from a customer
List Opportunities from a customer
Create an Opportunity from a customer
Customer Notes
List Customer Notes
Create a Customer Note
Get a Customer Note
Update a Customer Note
Delete a Customer Note
Contacts
List Contacts
Create a Contact
Get a Contact
Delete A Contact
Update a Contact
Merge Contacts
Opportunities
List Opportunities
Create an Opportunity
Get an Opportunity
Update an Opportunity
Delete an Opportunity
Plans
Import a Plan
Get a Plan by UUID
List Plans
Delete A Plan
Update A Plan
Subscription Events
List Subscriptions Events
Create Subscription Event
Delete Subscription Event
Update Subscription Event
Plan Groups
Create a Plan Group
Get a Plan Group by UUID
List Plan Groups
Delete A Plan Group
Update A Plan Group
List Plans In A Plan Group
Invoices
Import Invoices
List Customer Invoices
List Invoices
Retrieve an Invoice
Transactions
Create a Transaction
The same can be done with Payment class.
Subscriptions
List Customer Subscriptions
Cancel Customer Subscriptions
Or set the cancellation dates:
Metrics API
Retrieve all key metrics
Retrieve MRR
Retrieve ARR
Retrieve Average Revenue Per Account (ARPA)
Retrieve Average Sale Price (ASP)
Retrieve Customer Count
Retrieve Customer Churn Rate
Retrieve MRR Churn Rate
Retrieve LTV
List Customer Subscriptions
List Customer Activities
List Activities
php ChartMogul\Metrics\ActivitiesExport::create([ 'start-date' => '2020-06-02T00:00:00Z', 'end-date' => '2021-06-02T00:00:00Z' 'type' => 'churn' ]);
**Retrieve an Activities Export**
### Account
**Retrieve Account Details**
### Exceptions
The library throws following Exceptions:
- `ChartMogul\Exceptions\ChartMogulException`
- `ChartMogul\Exceptions\ConfigurationException`
- `ChartMogul\Exceptions\ForbiddenException`
- `ChartMogul\Exceptions\NotFoundException`
- `ChartMogul\Exceptions\ResourceInvalidException`
- `ChartMogul\Exceptions\SchemaInvalidException`
The following table describes the public methods of the error object.
| Methods | Type | Description |
|:----------:|:----------------:|:-------------------------------------------------------------------:|
| `getMessage()` | string | The error message |
| `getStatusCode()` | number | When the error occurs during an HTTP request, the HTTP status code. |
| `getResponse()` | array or string | HTTP response as array, or raw response if not parsable to array |
### Rate Limits & Exponential Backoff
The library will keep retrying if the request exceeds the rate limit or if there's any network related error.
By default, the request will be retried for 20 times (approximated 15 minutes) before finally giving up.
You can change the retry count using `Configuration` object:
## Development
You need `Docker` installed locally to use our `Makefile` workflow.
* Fork it.
* Create your feature branch (`git checkout -b my-new-feature`).
* Install dependencies: `make build`.
* Install Composer vendor dependencies with `make composer install`
* Write tests for your new features. Run tests and check test coverage with `make test`.
* To run any composer commands or php scripts, use `make composer <commands>` or `make php <script>`.
* If all tests are passed, push to the branch (`git push origin my-new-feature`).
* Create a new Pull Request.
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/chartmogul/chartmogul-php.
## License
The library is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
### The MIT License (MIT)
*Copyright (c) 2019 ChartMogul Ltd.*
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
All versions of chartmogul-php with dependencies
psr/http-message Version ^1.0 || ^2.0
psr/http-client-implementation Version ^1.0
doctrine/collections Version ^1.6 || ^2.0
stechstudio/backoff Version ^1.0
php-http/discovery Version ^1.13
nyholm/psr7 Version ^1.8