The HelloAsso PHP library offers a straightforward way to interact with the HelloAsso API in PHP applications. It features a collection of pre-built classes for API resources that automatically adapt to API responses, ensuring flexibility across different versions of the HelloAsso API.
PHP 7.4 and later. Should also work with PHP 8.0.
You can install the bindings via Composer. Run the following command:
composer require helloasso/helloasso-php
To use the bindings, use Composer's autoload:
require_once 'vendor/autoload.php';
Download the files and include autoload.php
:
<?php
require_once('/path/to/helloasso-php/vendor/autoload.php');
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: OAuth2
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new OpenAPI\Client\Api\AnnuaireApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$page_size = 20; // int | The number of items per page
$continuation_token = 'continuation_token_example'; // string | Continuation Token from which we wish to retrieve results
$hello_asso_api_v5_models_directory_list_forms_request = new \OpenAPI\Client\Model\HelloAssoApiV5ModelsDirectoryListFormsRequest(); // \OpenAPI\Client\Model\HelloAssoApiV5ModelsDirectoryListFormsRequest | Body which contains the filters to apply
try {
$result = $apiInstance->directoryFormsPost($page_size, $continuation_token, $hello_asso_api_v5_models_directory_list_forms_request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AnnuaireApi->directoryFormsPost: ', $e->getMessage(), PHP_EOL;
}
All URIs are relative to https://api.helloasso.com/v5
Class | Method | HTTP request | Description |
---|---|---|---|
AnnuaireApi | directoryFormsPost | POST /directory/forms | Récupérer les formulaires |
AnnuaireApi | directoryOrganizationsPost | POST /directory/organizations | Récupérer les organisations |
CheckoutApi | organizationsOrganizationSlugCheckoutIntentsCheckoutIntentIdGet | GET /organizations/{organizationSlug}/checkout-intents/{checkoutIntentId} | Récupérer une intention de paiement |
CheckoutApi | organizationsOrganizationSlugCheckoutIntentsPost | POST /organizations/{organizationSlug}/checkout-intents | Initialisation d'un Checkout |
CommandesApi | itemsItemIdGet | GET /items/{itemId} | Obtenir le détail d'un article contenu dans une commande |
CommandesApi | ordersOrderIdCancelPost | POST /orders/{orderId}/cancel | Annuler les paiements futurs pour une commande (pas de remboursement). |
CommandesApi | ordersOrderIdGet | GET /orders/{orderId} | Obtenir des informations détaillées sur une commande |
CommandesApi | organizationsOrganizationSlugFormsFormTypeFormSlugItemsGet | GET /organizations/{organizationSlug}/forms/{formType}/{formSlug}/items | Obtenir une liste d'articles vendus dans un formulaire |
CommandesApi | organizationsOrganizationSlugFormsFormTypeFormSlugOrdersGet | GET /organizations/{organizationSlug}/forms/{formType}/{formSlug}/orders | Obtenir les commandes d'un formulaire |
CommandesApi | organizationsOrganizationSlugItemsGet | GET /organizations/{organizationSlug}/items | Obtenir une liste d'articles vendus par une organisation |
CommandesApi | organizationsOrganizationSlugOrdersGet | GET /organizations/{organizationSlug}/orders | Obtenir les commandes d'une organisation |
FormulairesApi | organizationsOrganizationSlugFormTypesGet | GET /organizations/{organizationSlug}/formTypes | Obtenir une liste des types de formulaires pour une organisation |
FormulairesApi | organizationsOrganizationSlugFormsFormTypeActionQuickCreatePost | POST /organizations/{organizationSlug}/forms/{formType}/action/quick-create | Créer un événement simplifié pour un organisme |
FormulairesApi | organizationsOrganizationSlugFormsFormTypeFormSlugPublicGet | GET /organizations/{organizationSlug}/forms/{formType}/{formSlug}/public | Obtenir des données publiques détaillées sur un formulaire |
FormulairesApi | organizationsOrganizationSlugFormsGet | GET /organizations/{organizationSlug}/forms | Obtenir les formulaires d'une organisation |
ListeDeValeursApi | valuesCompanyLegalStatusGet | GET /values/company-legal-status | Obtenir la liste des statuts juridiques |
ListeDeValeursApi | valuesOrganizationCategoriesGet | GET /values/organization/categories | Obtenir la liste des catégories du JO |
ListeDeValeursApi | valuesTagsGet | GET /values/tags | Obtenir la liste des tags publiques |
OrganisationApi | organizationsLegalInformationsLegalStructuresGet | GET /organizations/legal-informations/legal-structures | Obtenir la structure juridique d'une organisation visible. |
OrganisationApi | organizationsLegalInformationsOrganizationSlugConfigurationGet | GET /organizations/legal-informations/{organizationSlug}/configuration | |
OrganisationApi | organizationsLegalInformationsTaxInformationTextsGet | GET /organizations/legal-informations/tax-information-texts | |
OrganisationApi | organizationsOrganizationSlugGet | GET /organizations/{organizationSlug} | Obtenir le détail d'une organisation |
OrganizationLegalInformationsApi | organizationsLegalInformationsOrganizationSlugConfigurationPut | PUT /organizations/legal-informations/{organizationSlug}/configuration | |
PaiementsApi | organizationsOrganizationSlugFormsFormTypeFormSlugPaymentsGet | GET /organizations/{organizationSlug}/forms/{formType}/{formSlug}/payments | Obtenir les informations des paiements effectués sur un formulaire |
PaiementsApi | organizationsOrganizationSlugPaymentsGet | GET /organizations/{organizationSlug}/payments | Obtenir les informations des paiements effectués sur une organisation |
PaiementsApi | organizationsOrganizationSlugPaymentsSearchGet | GET /organizations/{organizationSlug}/payments/search | Rechercher des paiements. |
PaiementsApi | paymentsPaymentIdGet | GET /payments/{paymentId} | Obtenir les informations détaillées d'un paiement. |
PaiementsApi | paymentsPaymentIdRefundPost | POST /payments/{paymentId}/refund | Rembourser un paiement. |
PartenairesApi | partnersMeApiClientsPut | PUT /partners/me/api-clients | Mise à jour du domaine |
PartenairesApi | partnersMeApiNotificationsDelete | DELETE /partners/me/api-notifications | Suppression de l'URL de notification principale |
PartenairesApi | partnersMeApiNotificationsOrganizationsOrganizationSlugDelete | DELETE /partners/me/api-notifications/organizations/{organizationSlug} | Suppression d'une URL de notification liée à une organisation |
PartenairesApi | partnersMeApiNotificationsOrganizationsOrganizationSlugPut | PUT /partners/me/api-notifications/organizations/{organizationSlug} | Mise à jour d'une URL de notification liée à une organisation |
PartenairesApi | partnersMeApiNotificationsPut | PUT /partners/me/api-notifications | Mise à jour de l'URL de notification principale |
PartenairesApi | partnersMeGet | GET /partners/me | Récupération des informations |
PartenairesApi | partnersMeOrganizationsGet | GET /partners/me/organizations | Obtenir toutes les organisations |
TagsApi | tagsTagNameGet | GET /tags/{tagName} | Obtenir le détail d'un tag interne |
TaxReceiptApi | organizationsOrganizationSlugTaxReceiptConfigurationGet | GET /organizations/{organizationSlug}/tax-receipt/configuration | |
TaxReceiptApi | organizationsOrganizationSlugTaxReceiptConfigurationPut | PUT /organizations/{organizationSlug}/tax-receipt/configuration | |
TaxReceiptApi | organizationsOrganizationSlugTaxReceiptPreviewPost | POST /organizations/{organizationSlug}/tax-receipt/preview | |
UtilisateursApi | usersMeOrganizationsGet | GET /users/me/organizations | Obtenir mes organisations |
- HelloAssoApiV5ModelsAccountCompanyLegalStatusModel
- HelloAssoApiV5ModelsAccountOrganismCategoryModel
- HelloAssoApiV5ModelsAccountsClientsApiClientModel
- HelloAssoApiV5ModelsAccountsClientsPublicPutApiClientRequest
- HelloAssoApiV5ModelsApiNotificationsApiNotificationType
- HelloAssoApiV5ModelsApiNotificationsApiUrlNotificationModel
- HelloAssoApiV5ModelsApiNotificationsPostApiUrlNotificationBody
- HelloAssoApiV5ModelsCartsCheckoutIntentResponse
- HelloAssoApiV5ModelsCartsCheckoutPayer
- HelloAssoApiV5ModelsCartsCheckoutTerm
- HelloAssoApiV5ModelsCartsInitCheckoutBody
- HelloAssoApiV5ModelsCartsInitCheckoutResponse
- HelloAssoApiV5ModelsCommonContactModel
- HelloAssoApiV5ModelsCommonDocumentModel
- HelloAssoApiV5ModelsCommonMetaModel
- HelloAssoApiV5ModelsCommonPaginationModel
- HelloAssoApiV5ModelsCommonPlaceModel
- HelloAssoApiV5ModelsDirectoryDirectoryOrganizationPublicModel
- HelloAssoApiV5ModelsDirectoryListFormsRequest
- HelloAssoApiV5ModelsDirectoryListOrganizationsRequest
- HelloAssoApiV5ModelsDirectoryPartnerOrganizationModel
- HelloAssoApiV5ModelsDirectorySynchronizableFormModel
- HelloAssoApiV5ModelsDirectorySynchronizableOrganizationModel
- HelloAssoApiV5ModelsEnumsFieldType
- HelloAssoApiV5ModelsEnumsFormState
- HelloAssoApiV5ModelsEnumsFormType
- HelloAssoApiV5ModelsEnumsItemState
- HelloAssoApiV5ModelsEnumsMembershipValidityType
- HelloAssoApiV5ModelsEnumsOperationState
- HelloAssoApiV5ModelsEnumsOrganizationType
- HelloAssoApiV5ModelsEnumsPaymentCashOutState
- HelloAssoApiV5ModelsEnumsPaymentFrequencyType
- HelloAssoApiV5ModelsEnumsPaymentMeans
- HelloAssoApiV5ModelsEnumsPaymentProviderType
- HelloAssoApiV5ModelsEnumsPaymentState
- HelloAssoApiV5ModelsEnumsPaymentType
- HelloAssoApiV5ModelsEnumsPriceCategory
- HelloAssoApiV5ModelsEnumsRecordActionType
- HelloAssoApiV5ModelsEnumsSortField
- HelloAssoApiV5ModelsEnumsSortOrder
- HelloAssoApiV5ModelsEnumsTagType
- HelloAssoApiV5ModelsEnumsTierType
- HelloAssoApiV5ModelsFormsFormBasicModel
- HelloAssoApiV5ModelsFormsFormLightModel
- HelloAssoApiV5ModelsFormsFormPublicModel
- HelloAssoApiV5ModelsFormsFormQuickCreateModel
- HelloAssoApiV5ModelsFormsFormQuickCreateRequest
- HelloAssoApiV5ModelsFormsTermModel
- HelloAssoApiV5ModelsFormsTierLightModel
- HelloAssoApiV5ModelsFormsTierPublicModel
- HelloAssoApiV5ModelsOrganizationLegalInformationsOrganizationLegalStructuresModel
- HelloAssoApiV5ModelsOrganizationLegalInformationsUpdateOrganizationLegalInformationConfigurationBody
- HelloAssoApiV5ModelsOrganizationOrganizationBasicModel
- HelloAssoApiV5ModelsOrganizationOrganizationLightModel
- HelloAssoApiV5ModelsOrganizationOrganizationModel
- HelloAssoApiV5ModelsPartnerStatisticsModel
- HelloAssoApiV5ModelsPartnersPartnerPublicModel
- HelloAssoApiV5ModelsPaymentPublicPaymentModel
- HelloAssoApiV5ModelsPaymentRefundOperationModel
- HelloAssoApiV5ModelsStatisticsItem
- HelloAssoApiV5ModelsStatisticsItemCustomField
- HelloAssoApiV5ModelsStatisticsItemDetail
- HelloAssoApiV5ModelsStatisticsItemDiscount
- HelloAssoApiV5ModelsStatisticsItemOption
- HelloAssoApiV5ModelsStatisticsItemPayment
- HelloAssoApiV5ModelsStatisticsOrder
- HelloAssoApiV5ModelsStatisticsOrderAmountModel
- HelloAssoApiV5ModelsStatisticsOrderDetail
- HelloAssoApiV5ModelsStatisticsOrderItem
- HelloAssoApiV5ModelsStatisticsOrderLight
- HelloAssoApiV5ModelsStatisticsOrderPayment
- HelloAssoApiV5ModelsStatisticsPayer
- HelloAssoApiV5ModelsStatisticsPayment
- HelloAssoApiV5ModelsStatisticsPaymentDetail
- HelloAssoApiV5ModelsStatisticsPaymentItem
- HelloAssoApiV5ModelsStatisticsRefundOperationLightModel
- HelloAssoApiV5ModelsStatisticsShareItem
- HelloAssoApiV5ModelsStatisticsSharePayment
- HelloAssoApiV5ModelsStatisticsUser
- HelloAssoApiV5ModelsTagsInternalTagModel
- HelloAssoApiV5ModelsTagsPublicTagModel
- HelloAssoModelsAccountsOrganizationLegalInformationsFiscalReceiptFormatOptionModel
- HelloAssoModelsAccountsOrganizationLegalInformationsFiscalReceiptSignatoryModel
- HelloAssoModelsAccountsOrganizationLegalInformationsOrganizationFiscalReceiptOptionsConfiguration
- HelloAssoModelsAccountsOrganizationLegalInformationsOrganizationLegalInformationConfiguration
- HelloAssoModelsAccountsOrganizationLegalInformationsTaxInformationText
- HelloAssoModelsComplianceV2CommonAddressAddressModelSnapshot
- HelloAssoModelsEnumsGlobalRole
- HelloAssoModelsSharedGeoLocation
- ResultsWithPaginationModelFormLightModel
- ResultsWithPaginationModelItem
- ResultsWithPaginationModelOrder
- ResultsWithPaginationModelPartnerOrganizationModel
- ResultsWithPaginationModelPayment
- ResultsWithPaginationModelPublicPaymentModel
- ResultsWithPaginationModelSynchronizableFormModel
- ResultsWithPaginationModelSynchronizableOrganizationModel
We use OAuth2 for authentication, so to avoid reinventing the wheel, we recommend using the league/oauth2-client package
Install the league/oauth2-client package:
composer require league/oauth2-client
require 'vendor/autoload.php';
use League\OAuth2\Client\Provider\GenericProvider;
$provider = new GenericProvider([
'clientId' => 'your_client_id',
'clientSecret' => 'your_client_secret',
'urlAccessToken' => 'https://api.helloasso.com/oauth2/token',
'urlAuthorize' => '',
'urlResourceOwnerDetails' => ''
]);
try {
// Get access token using client credentials
$accessToken = $provider->getAccessToken('client_credentials');
echo 'Access Token: ' . $accessToken->getToken();
echo 'Expires in: ' . $accessToken->getExpires();
echo 'Refresh Token: ' . $accessToken->getRefreshToken();
} catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
echo 'Error: ' . $e->getMessage();
}
require 'vendor/autoload.php';
use League\OAuth2\Client\Provider\GenericProvider;
$provider = new GenericProvider([
'clientId' => 'your_client_id',
'clientSecret' => 'your_client_secret',
'urlAccessToken' => 'https://api.helloasso.com/oauth2/token',
'urlAuthorize' => '',
'urlResourceOwnerDetails' => ''
]);
$refreshToken = 'your_refresh_token';
try {
// Refresh the access token
$newAccessToken = $provider->getAccessToken('refresh_token', [
'refresh_token' => $refreshToken,
]);
echo 'New Access Token: ' . $newAccessToken->getToken();
echo 'Expires in: ' . $newAccessToken->getExpires();
echo 'New Refresh Token: ' . $accessToken->getRefreshToken();
} catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
echo 'Error: ' . $e->getMessage();
}
require 'vendor/autoload.php';
use League\OAuth2\Client\Provider\GenericProvider;
$provider = new GenericProvider([
'clientId' => 'your_client_id',
'clientSecret' => 'your_client_secret',
'redirectUri' => 'https://your-app.com/callback',
'urlAuthorize' => 'https://auth.helloasso.com/authorize',
'urlAccessToken' => 'https://api.helloasso.com/oauth2/token',
'urlResourceOwnerDetails' => ''
]);
// Function to generate a random code verifier
function generateCodeVerifier() {
return bin2hex(random_bytes(32));
}
// Function to generate a code challenge from the code verifier
function generateCodeChallenge($codeVerifier) {
return rtrim(strtr(base64_encode(hash('sha256', $codeVerifier, true)), '+/', '-_'), '=');
}
// Step 1: Generate the authorization URL
function GetAuthorizationUrl($provider) {
$codeVerifier = generateCodeVerifier();
$codeChallenge = generateCodeChallenge($codeVerifier);
$authorizationUrl = $provider->getAuthorizationUrl([
'state' => 'random_state_string',
'code_challenge' => $codeChallenge,
'code_challenge_method' => 'S256',
]);
echo 'Authorization URL: ' . $authorizationUrl . "\n";
echo 'Code verifier: ' . $codeVerifier . "\n";
}
// Step 2: Handle the callback and exchange the authorization code for an access token
function GetAccessTokenFromCode($provider, $authorizationCode, $codeVerifier) {
try {
// Get access token
$accessToken = $provider->getAccessToken('authorization_code', [
'code' => $authorizationCode,
'code_verifier' => $codeVerifier
]);
echo 'Access Token: ' . $accessToken->getToken() . "\n";
echo 'Expires in: ' . $accessToken->getExpires() . "\n";
echo 'New Refresh Token: ' . $accessToken->getRefreshToken() . "\n";
} catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
echo 'Error: ' . $e->getMessage();
}
}
GetAuthorizationUrl($provider);
// After user authorizes, exchange the code (passed in the redirect URL callback)
//GetAccessTokenFromCode($provider, 'your_authorization_code', 'your_code_verifier');
To run the tests, use:
composer install
vendor/bin/phpunit
This SDK is automatically generated by the OpenAPI Generator project:
- Generator version: 7.10.0
- Build package: org.openapitools.codegen.languages.PhpClientCodegen