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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

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 | Security | License



Installation

This library requires PHP 7.1 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 (6.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:

Security Best Practices

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

Include extra fields:

List Datasources

Include extra fields:

Delete a Datasource

Customers

Import a Customer

List Customers

Find Customer By External ID

Delete A Customer

Get a Customer

Get a Customer with Overrides and Historical Values

Search for Customers

Merge Customers

Unmerge Customers

Update a Customer

Connect Subscriptions

OR (Recommended)

OR (Deprecated)

Disconnect Subscriptions

OR (Recommended)

OR (Deprecated)

Customer Attributes

Retrieve Customer's Attributes

Tags

Add Tags to a Customer

Add Tags Using Array (Alternative)

Add Tags to Customers with email

Remove Tags from a Customer

Remove Tags Using Array (Alternative)

Custom Attributes

Add Custom Attributes to a Customer

Add Custom Attributes Using Array (Alternative)

Add Custom Attributes to Customers with email

Update Custom Attributes of a Customer

Update Custom Attributes Using Array (Alternative)

Remove Custom Attributes from a Customer

Remove Custom Attributes Using Array (Alternative)

Send Custom Attribute Overrides

Setting an attribute's flag to true overrides its value with what the request writes. While overridden, the attribute is protected from data-source syncs and from API writes that don't carry a flag for it — those are skipped silently and the response returns the overridden value; a remove keeps the attribute and the response message names it.

To change an overridden value, send the write with the flag again: true keeps the override at the new value, false removes it. Setting a flag to false removes an existing override and restores the most recent value from the edit history (on a create it does nothing).

The WithOverrides methods return the whole response, including the overrides object. On these endpoints (and retrieveAttributes) it has namespaces at the top level, e.g. ['custom' => ['channel' => true]] — there is no attributes wrapper in $result['overrides']. Customer responses and addCustomAttributesByEmail entries use the wrapped shape instead (['company' => true, 'attributes' => ['custom' => [...]]]), and the SDK keeps the customer object in that shape by syncing each call's overrides into $customer->overrides['attributes'].

An override is only accepted for an attribute that already exists on the account and has history tracking enabled; otherwise the call returns a 422 (not_found / not_trackable), before anything is written. A brand-new key therefore takes two steps:

Retrieve a Customer's Attributes with Overrides

The two query params are independent. Unlike Customer::retrieve, attributes_with_history here accepts only custom attribute names (custom.<key>, case-sensitive); a bare field name like company returns a 422. History entries come back newest first.

List Contacts from a customer

Create a Contact from a customer

List Entity Notes for a customer

Create an Entity Note for a customer

List Customer Notes from a customer (Deprecated)

Note: $customer->notes() and $customer->createNote() are deprecated and emit an E_USER_DEPRECATED warning. Use $customer->entityNotes() and $customer->createEntityNote() instead.

Create a Customer Note from a customer (Deprecated)

List Opportunities from a customer

Create an Opportunity from a customer

List Tasks for a customer

Create a Task for a customer

Customer Notes

Note: ChartMogul\CustomerNote (the /v1/customer_notes API) is deprecated and every method emits an E_USER_DEPRECATED warning. Use ChartMogul\EntityNote (the /v1/notes API, see Entity Notes) instead. The behaviour and endpoint of CustomerNote are unchanged.

List Customer Notes

Create a Customer Note

Get a Customer Note

Update a Customer Note

Delete a Customer Note

Entity Notes

Entity notes can be attached to a customer or to a contact. Each note exposes customer_uuid (null for contact notes) and, where available, associated_object (customer or contact) and associated_object_uuid.

List Entity Notes

Create an Entity Note for a customer

Create an Entity Note for a contact

Get an Entity Note

Update an Entity Note

If the request contains nothing to update, the API responds with 304 Not Modified and an empty EntityNote (all properties null) is returned.

Delete an Entity Note

Contacts

List Contacts

Create a Contact

customer_uuid and data_source_uuid are optional, so a contact can be created without a customer. In responses customer_uuid and data_source_uuid may be null.

Get a Contact

Get a Contact with Overrides and Historical Values

Delete A Contact

Update a Contact

Update a Contact with Overrides

Contact overrides follow the same rules as customer overrides: an overridden field is protected from data-source syncs and from API writes that don't carry its flag (a later Contact::update without the flag is reverted), and false removes the override, restoring the most recent edit-history value. Contact custom attribute overrides are not yet implemented by the API — a custom attribute key in contact overrides is rejected as not_overridable. Write responses always include the contact's current overrides; $customer->createContact([...]) accepts overrides the same way.

Merge Contacts

List Tasks for a contact

Create a Task for a contact

List Entity Notes for a contact

Create an Entity Note for a contact

The contact helpers send associated_object_identifier for the contact unless the data already contains customer_uuid or associated_object_identifier.

Opportunities

List Opportunities

Create an Opportunity

Get an Opportunity

Update an Opportunity

Delete an Opportunity

Tasks

List Tasks

Create a Task

Create a Task for a contact

Tasks expose customer_uuid (null for contact tasks) and, where available, associated_object (customer or contact) and associated_object_uuid.

Get a Task

Update a Task

If the request contains nothing to update, the API responds with 304 Not Modified and an empty Task (all properties null) is returned.

Delete a Task

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

Update an Invoice Status

Disable an Invoice

Line Items

Retrieve a Line Item

Update a Line Item

Delete a Line Item

Disable a Line Item

Retrieve a Line Item by External ID

Update a Line Item by External ID

Delete a Line Item by External ID

Transactions

Create a Transaction

The same can be done with Payment class.

Retrieve a Transaction

Update a Transaction

Delete a Transaction

Disable a Transaction

Retrieve a Transaction by External ID

Update a Transaction by External ID

Delete a Transaction by External ID

Subscriptions

List Customer Subscriptions

Note: The following methods are deprecated. Use ChartMogul\Metrics\Customers\Subscription::connect() and ChartMogul\Metrics\Customers\Subscription::disconnect() instead. See the Connect/Disconnect Subscriptions section above for recommended usage.

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' ]); php $id = '7f554dba-4a41-4cb2-9790-2045e4c3a5b1'; ChartMogul\Metrics\ActivitiesExport::retrieve($id); php ChartMogul\Account::retrieve(); php ChartMogul\Configuration::getDefaultConfiguration() ->setApiKey('') ->setRetries(15); //0 disables retrying



## 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.

## Releasing

See [RELEASING.md](RELEASING.md) for the full release process.

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/chartmogul/chartmogul-php.

## Security

### Verifying Releases

All releases of this library are published as [immutable GitHub Releases](https://github.com/chartmogul/chartmogul-php/releases) with protected tags and as a package on [Packagist](https://packagist.org/packages/chartmogul/chartmogul-php).

To maximize supply chain security:
- **Commit your `composer.lock`** to version control - it records content hashes for all dependencies, ensuring reproducible and tamper-evident installs
- **Use `composer install`** (not `composer update`) in CI environments for deterministic builds from the lockfile

## 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

PHP Build Version
Package Version
Requires php Version >=7.1
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
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package chartmogul/chartmogul-php contains the following files

Loading the files please wait ...