Download the PHP package circle-interactive/civicrm-api without Composer

On this page you can find all versions of the php package circle-interactive/civicrm-api. 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 civicrm-api

civicrm-api

civicrm-api is a Composer package that allows developers to interact with a CiviCRM instance using the REST API v4 functionality within CiviCRM.

This code is intended to be used outside of a CiviCRM deployment environment. As such, the codebase adheres to PSR-12 coding standards instead of Drupal/Wordpress/CiviCRM coding standards.

Installation

To install the library, run the following command:

composer require circle-interactive/civicrm-api

Requirements

  1. The CiviCRM server must be running on v5.47 or later.

In this release, the /civicrm/ajax/* endpoints were exposed as web services as part of currently ongoing efforts to expose REST endpoints via the standard CiviCRM routing system. Click here to learn more.

  1. Your application must use an HTTP client that is PSR-18 compliant.

If your application uses an HTTP client that is not compliant with PSR-18, it will be necessary to write a decorator class that implements a sendRequest method.

How to Use

NB: As you can see from the examples, this library does not deserialize responses. This is by design.

Calling code is responsible for response deserialization and handling the data from that response.

Guzzle Example

Symfony HTTP Client Example

NB: Use correct, case-specific Entity names when interacting with the API (for example: "activity" will return an error, use "Activity" instead)

Available Functions

The examples make use of the get method exposed by this library. However, this is not the only available method. The list of available methods is as follows:

  1. getActions
  2. getFields
  3. get
  4. create
  5. update
  6. save
  7. delete
  8. replace

As well as the above, the library also exposes the request method. This allows for arbitrary combinations of Entity, action, and params. An example of usage of this method can be seen below:

This would be useful in the following (non-exhaustive list of) situations:

Available Authentication Methods

This library uses the X-Civi-Auth Header when making requests to CiviCRM instances. As such, the following authentication methods are available:

Type of Authentication Library Mapping
Basic Authentication Circle\CiviCRM\AuthenticationTypes::BASIC
API Key Authentication Circle\CiviCRM\AuthenticationTypes::BEARER_API_KEY
JWT Authentication Circle\CiviCRM\AuthenticationTypes::BEARER_JWT

Any other form of authentication is unsupported by this library.

NB: When creating a Client object, only pass the Authentication Key (ie: MYKEY).

Do not pass the Bearer or Basic keywords (ie: Bearer MYKEY or Basic MYKEY)as these are put in place by the library.

Note on Basic Authentication

When using Basic Authentication, the key is a base64 encoded string: B64(USER:PASSWORD). You will need to provide the Base64 encoded string as the $authKey parameter to the Circle\CiviCRM\Client constructor.

Contributing

If you find a bug or other issue within this library, please raise an issue in this Github repository.

To run tests, run composer test. The library uses Pest for automated testing, and adheres to PHPStan Level 6.

Resources

Support

The technical team at Circle Interactive are responsible for the maintenance of this library. Circle offer CiviCRM implementations for third-sector clients of any kind, no matter the size.

License

This package is licensed with AGPL-3.0, as is CiviCRM.


All versions of civicrm-api with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ext-json Version *
laminas/laminas-diactoros Version ^2.9
psr/http-client Version ^1.0.1
psr/http-factory Version ^1.0
psr/http-message Version ^1.0
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 circle-interactive/civicrm-api contains the following files

Loading the files please wait ....