Description
An SDK to work with Personio (https://www.personio.de)
This library comes with out of the box support for Guzzle and for HTTP clients implementing PSR-18.
Personio SDK for PHP alternatives and similar libraries
Based on the "API" category.
Alternatively, view Personio SDK for PHP alternatives based on common mentions on social networks and blogs.
-
API Platform
Create REST and GraphQL APIs, scaffold Jamstack webapps, stream changes in real-time. -
PHP-CRUD-API
Single file PHP script that adds a REST API to a SQL database -
Firebase Admin SDK for PHP
Unofficial Firebase Admin SDK for PHP -
Restler
Simple and effective multi-format Web API Server to host your PHP API as Pragmatic REST and/or RESTful API -
wsdl2phpgenerator
Simple utility and class library for generating php classes from a wsdl file. -
Hateoas
A PHP library to support implementing representations for HATEOAS REST web services. -
OverblogGraphQLBundle
This bundle provides tools to build a complete GraphQL API server in your Symfony App. -
Pinterest Bot for PHP
This PHP library will help you to work with your Pinterest account without using any API account credentials. -
Symfony DataTables Bundle
DataTables bundle for Symfony -
Symfony GraphQl Bundle
Pure PHP implementation of GraphQL Server โ Symfony Bundle -
PSX Framework
PSX is an innovative PHP framework dedicated to build fully typed REST APIs. -
Slack for PHP
A simple PHP package for sending messages to Slack, with a focus on ease of use and elegant syntax. -
Drest
Quickly and easily expose Doctrine entities as REST resource endpoints with the use of simple configuration with annotations, yaml, json or a PHP array. -
chubbyphp-framework
A minimal, highly performant middleware PSR-15 microframework built with as little complexity as possible, aimed primarily at those developers who want to understand all the vendors they use. -
Behapi
Behat extension for those who want to write acceptances tests for apis -
Symfony 2 GraphQl Bundle
GraphQL Bundle for Symfony 2. -
Bearer PHP Client
Bearer client for the PHP programming language -
cidaas SDK for php
With this SDK, you can integrate cidaas smoothly and with minimal effort into your PHP application. It enables you to map the most important user flows for OAuth2 and OIDC compliant authentication. Secure โ Fast โ And unrivaled Swabian. -
mite SDK for PHP
Interact with mite from your PHP application. -
phpDoc2pdf
Create PDF formatted documentation for your PHP projects -
yii2-fractal
A set of utils and actions for build API following JSON:Api specification, based on league/fractal -
icanhazstring/expressive-hashids-middleware
PSR-15/PSR-7 compliant middleware using ivanakimov/hashids.php
WorkOS - The modern identity platform for B2B SaaS
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Personio SDK for PHP or a related project?
README
Personio SDK for PHP
Interact with Personio from your PHP application.
Requirements
- A Client ID and Client Secret from (You can generate them at https://xxx.personio.de/configuration/api/credentials)
Installation
composer require gamez/personio
Setup
Creating an API client based on Guzzle
composer require guzzlehttp/guzzle
<?php
// a file in the same directory in which you perfomed the composer command(s)
require 'vendor/autoload.php';
use Gamez\Personio\Api\GuzzleApiClient;
$clientId = 'xxx';
$clientSecret = 'xxx';
$apiClient = GuzzleApiClient::with($clientId, $clientSecret);
Creating an API client based on a PSR-18 HTTP Client
The following example uses kriswallsmith/buzz as the client and nyholm/psr7 as the Request Factory, but you can use any library that implements PSR-17 and PSR-18.
composer require kriswallsmith/buzz:^1.0 nyholm/psr7:^1.0
<?php
// a file in the same directory in which you perfomed the composer command(s)
require 'vendor/autoload.php';
use Buzz\Client\FileGetContents;
use Gamez\Personio\Api\HttpApiClient;
use Nyholm\Psr7\Factory\Psr17Factory;
$clientId = 'xxx';
$clientSecret = 'xxx';
$psr17Factory = new Psr17Factory();
$httpClient = new FileGetContents($psr17Factory);
$apiClient = HttpApiClient::with($clientId, $clientSecret, $httpClient, $psr17Factory);
Creating your own API client
If you want to create your own API client, implement the \Gamez\Personio\Api\ApiClient
interface
and use your implementation.
Caching HTTP requests
To cache HTTP requests to the API, you can add a caching middleware/plugin to the HTTP client before injecting it into the API client instance. See the documentation of the respective component for instructions on how to do that.
- Guzzle: kevinrob/guzzle-cache-middleware
- HTTPlug: Cache Plugin
Usage
Simple API
[Gamez\Personio\SimpleApi
](./src/SimpleApi.php) is the easiest and fastest way to access the data in your
Personio account. Its methods are named after the available REST API endpoints
and return arrays of data. You can inspect the available methods by looking at the
[source code of the Gamez\Personio\SimpleApi
class](./src/SimpleApi.php) or by using the
autocompletion features of your IDE.
The Simple API doesn't get in your way when accessing the Personio API, but it doesn't provide additional features either. It will, for example, not tell you if you used a wrong query parameter or invalid field value, so you will have to rely on the returned API responses.
For information on which query parameters and field values are allowed, see Personio Developer Hub.
Catching errors
All exceptions thrown by this library implement the \Gamez\Personio\Exception\PersonioException
interface.
Exceptions thrown while using an API Client will throw a \Gamez\Personio\Exception\ApiClientError
.
<?php
use Gamez\Personio\Exception\ApiClientError;
use Gamez\Personio\Exception\PersonioException;
try {
/** @var \Gamez\Personio\Api\ApiClient $apiClient */
$result = $apiClient->get('nice-try');
} catch (ApiClientError $e) {
$message = "Something went wrong while accessing {$e->getRequest()->getUri()}";
if ($response = $e->getResponse()) {
$message .= " ({$response->getStatusCode()})";
}
$message .= ' : '.$e->getMessage();
exit($message);
} catch (PersonioException $e) {
exit('Something not API related went really wrong: '.$e->getMessage());
}
Roadmap
- Tests
- Interfaces and value objects
- CLI tool
- Better documentation