Download the PHP package remp/crm-api-module without Composer

On this page you can find all versions of the php package remp/crm-api-module. 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 crm-api-module

CRM API Module

Translation status @ Weblate

This documentation serves as a complement to CRM Skeleton documentation related to creating and registering API handlers.

It describes API handlers provided by this module for others to use.

Enabling module

Make sure you add extension to your app/config/config.neon file.

Configuration

Preflight requests

Module allows you to configure preflight request handling. Add following snippet to your config.neon file:

You can configure allowed origins by explicitly stating them or by using wildcards. Following configurations are valid:

API requests logging

You can globally enable or disable API logging in the CRM admin - config section. If the logging is enabled, you can further configure which specific paths should be logged or not.

We recommend using configuration of blacklist over whitelist. Otherwise you might encounter a scenario, where logs from one of our APIs might be missing when you need them.

To enable blacklist, add following snippet to your config.neon file:

The LoggerEndpointIdentifier requires three parameters: version, package and apiCall - same parameters which you use when you register a new API handler. The snippet above will not log requests to the /api/v1/foo/bar endpoint.

You can also use wildcards where necessary:

Blacklist and whitelist cannot be combined, the latter configured wins.

Data retention configuration

You can configure time before which application:cleanup deletes old repository data and column which it uses by using (in your project configuration file):

Database tables migration

Because of need of changing primary keys (int -> bigint), in tables that contain lots of data (or have risk of overflowing primary key if its int), we had to create migration process. Since some tables are very exposed and cannot be locked for more than a couple of seconds, we decided to create new tables, migrate the data manually and keep the old and new table in sync while migrating.

This migration process is necessary only for installations after specific version for specific table, and is two steps process.

Api logs migration (installed before version 2.5.0)

Consists of api_logs table migration.

Steps:

  1. Run phinx migrations command phinx:migrate, which creates new table api_logs_v2 (in case there is no data in table, migration just changes type of primary key and next steps are not needed).
  2. Run command api:convert_api_logs_to_bigint, which copies data from old table to new (e.g. api_logs to api_logs_v2). Command will after successful migration atomically rename tables (e.g. api_logs -> api_logs_old and api_logs_v2 -> api_logs), so when the migration ends only new tables are used.

It's recommended to run application:bigint_migration_cleanup api_logs command, at least 2 weeks (to preserve backup data, if some issue emerges) after successful migration to drop left-over tables.

API documentation

All examples use http://crm.press as a base domain. Please change the host to the one you use before executing the examples.

All examples use XXX as a default value for authorization token, please replace it with the real tokens:

API responses can contain following HTTP codes:

Value Description
200 OK Successful response, default value
400 Bad Request Invalid request (missing required parameters)
403 Forbidden The authorization failed (provided token was not valid)
404 Not found Referenced resource wasn't found

If possible, the response includes application/json encoded payload with message explaining the error further.


GET /api/v1/token/check

API servers for checking the validity of provided Bearer token within header.

Headers:
Name Value Required
Authorization Bearer XXX yes
Example:

Response:


All versions of crm-api-module with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
justinrainbow/json-schema Version ^5.2
spatie/array-to-xml Version ^3.1
tomaj/nette-api Version ^2.6
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 remp/crm-api-module contains the following files

Loading the files please wait ....