Download the PHP package moesif/moesif-symfony without Composer

On this page you can find all versions of the php package moesif/moesif-symfony. 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 moesif-symfony

Moesif Symfony SDK Documentation

by Moesif, the API analytics and API monetization platform.

Moesif's official SDK for PHP Symfony allows you to automatically capture API traffic and send to the Moesif API Analytics platform.

If you're new to Moesif, see our Getting Started resources to quickly get up and running.

Supported Symfony Versions

The SDK currently supports all Symfony 5.x versions.

Prerequisites

Before using this SDK, make sure you have the following:

Get Your Moesif Application ID

After you log into Moesif Portal, you can get your Moesif Application ID during the onboarding steps. You can always access the Application ID any time by following these steps from Moesif Portal after logging in:

  1. Select the account icon to bring up the settings menu.
  2. Select Installation or API Keys.
  3. Copy your Moesif Application ID from the Collector Application ID field.

Install the SDK

Moesif Symfony SDK is available through Composer, the dependency manager for PHP. After you have Composer installed, execute the following command:

Otherwise, manually add moesif/moesif-symfony to your composer.json file.

Enable the SDK

Follow these steps to enable the SDK:

  1. In your project's config/packages directory, add a moesif.yaml file. This file holds your configuration options.
  2. The configuration file requires you to at least specify your Moesif Application ID. The following shows an example:

For more configuration options, see YAML Configuration Options.

Configure the SDK

See the available configuration options to learn how to configure the SDK for your use case.

Troubleshoot

For a general troubleshooting guide that can help you solve common problems, see Server Troubleshooting Guide.

Other troubleshooting supports:

Configuration Options

The following sections describe the available configuration options that you can define in moesif.yaml.

applicationId (Required)

Data type
String

A string that identifies your application..

debug

Data type
bool

Set to true to print debug messages into the debug and error logs. This can help you troubleshoot integration issues.

options

Data type
Object

If set, contains various options to configure the SDK beyond the defaults.

In this object, you can set the following options:

max_queue_size

Data type Default
Integer 15

If set, overrides the default max_queue_size before sending data to Moesif.

max_batch_size

Data type Default
Integer 10

If set, overrides the default max_batch_size that is sent over to Moesif.

hooks_class

Data type
String

If set, this must be your implementation of MoesifHooksInterface.

User Hook Class Options

You can override and customize certain functionalities within the plugin with hooks. For example, create a file MyMoesifHooks.php and implement the MoesifHooksInterface:

See the Example Implementation for an example.

Make sure to set the hooks_class configuration option to the path of your implementation file.

The methods you need to implement for MoesifHooksInterface are the following:

identifyUserId

Data type Parameters Return type
Function ($request, $response) String

Optional.

This function takes the $request and $response arguments and returns a string for a user ID. This enables Moesif to attribute API requests to individual unique users so you can understand who calls your API. You can use this simultaneously with identifyCompanyId to track both individual customers and also the companies they are part of.

identifyCompanyId

Data type Parameters Return type
Function ($request, $response) String

Optional.

This function takes the $request and $response arguments and returns a string for a company ID. If you have a B2B business, this method enables Moesif to attribute API requests to specific companies or organizations so you can understand which accounts call your API. You can use this simultaneously with identifyUserId to track both individual customers and the companies they are part of.

identifySessionToken

Data type Parameters Return type
Function ($request, $response) String

Optional.

A function that takes the $request and $response arguments and returns a string for session or auth token. Moesif automatically creates sessions by processing your API data, but you can override this through the identifySessionId method if you're not happy with the results.

maskRequestHeaders

Data type Parameters Return type
Function ($headers) $headers

Optional.

A function that takes the $headers argument for a request. The argument is an associative array. The method returns an associative array with your sensitive request headers removed or masked.

maskRequestBody

Data type Parameters Return type
Function ($body) $body

Optional.

A function that takes the $body argument for request body. The argument an associative array representation of JSON. The method returns an associative array with any request body information removed.

maskResponseHeaders

Data type Parameters Return type
Function ($headers) $headers

Optional.

Same as maskRequestHeaders, but for HTTP responses.

maskResponseBody

Data type Parameters Return type
Function ($body) $body

Optional.

Same as maskResponseBody, but for HTTP responses.

getMetadata

Data type Parameters Return type
Function ($request, $response) Associative Array

Optional.

A function that takes the $request and $response arguments and returns $metadata. $metadata is an associative array representation of JSON.

skip

Data type Parameters Return type
Function ($request, $response) bool

Optional.

A function that takes the $request and $response arguments. Returns true if you want to skip the event. Skipping an event means Moesif doesn't log the event.

Example Implementation

The following example shows what the MyMoesifHooks.php file may look like with a MoesifHooksInterface implementation:

Examples

The following examples demonstrate how to add and update customer information.

Update a Single User

The following example shows how you can create or update a user profile in Moesif using the updateUser function.

The metadata field can contain any customer demographic or other information you want to store.

Only the user_id field is required.

For more information, see the PHP API Reference about updating a singer user.

Update Users in Batch

You can use the updateUsersBatch function to update a list of users in one batch.

Only the user_id field is required.

For more information, see the PHP API Reference about updating users in batch.

Update a Single Company

To create or update a company profile in Moesif, use the updateCompany function.

The metadata field can contain any company demographic or other information you want to store.

Only the company_id field is required.

For more information, see the PHP API Reference about updating a single company.

Update Companies in Batch

To update a list of companies in one batch, use the updateCompaniesBatch function.

Only the company_id field is required.

For more information, see the PHP API Reference about updating companies in batch.

How to Get Help

If you face any issues using this SDK, try the support team.

Explore Other Integrations

Explore other integration options from Moesif:


All versions of moesif-symfony with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.5
symfony/framework-bundle Version ^5.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 moesif/moesif-symfony contains the following files

Loading the files please wait ....