julienbornstein / doctolib-php
Doctolib PHP Client
0.1.2
2022-01-25 15:01 UTC
Requires
- php: >=7.4
- ext-json: *
- symfony/http-client: ^5.2
- symfony/http-foundation: ^5.2
- symfony/options-resolver: ^5.2
- symfony/serializer-pack: ^1.0
- webmozart/assert: ^1.10
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpmd/phpmd: ^2.10
- phpspec/prophecy-phpunit: ^2.0
- phpstan/phpstan: ^0.12.87
- phpunit/phpunit: 9.*
- symfony/debug-pack: ^1.0
This package is auto-updated.
Last update: 2024-12-25 21:48:47 UTC
README
Note: This is an UNOFFICIAL Doctolib PHP Client.
This is a PHP client for Doctolib. It includes the following:
- Helper methods for REST endpoints:
- Search Profiles (Doctor) by Speciality and Location, and get Booking and Availability information.
- Get Patient, Profile, Appointment.
- Create, Confirm, Delete an Appointment.
Authentication.broken
- PSR-4 autoloading support.
Requirements
- PHP 7.4 or later.
- PHP cURL extension (Usually included with PHP).
Installation
Install it using Composer:
$ composer require julienbornstein/doctolib-php
Usage
$doctolib = new Doctolib\Client( new Symfony\Component\HttpClient\HttpClient(), SerializerFactory::create() ); $searchResults = $doctolib->search('dentiste'); $speciality = $searchResults['specialities'][0]; $profiles = $doctolib->searchProfilesBySpecialityAndLocation('dentiste', '75009-paris'); // = https://www.doctolib.fr/dentiste/75009-paris $profiles = $doctolib->searchProfilesBySpecialityAndLocation('dentiste', '75009-paris', [ 'latitude' => 48.8785328, 'longitude' => 2.3377854, ]); $booking = $doctolib->getBooking('cabinet-dentaire-haussmann-saint-lazare'); $agendas = $booking->getAgendas(); $visitMotives = Agenda::getVisitMotivesForAgendas($agendas); $tomorrow = new DateTime('tomorrow'); $visitMotive = $visitMotives[0]; $availabilities = $doctolib->getAvailabilities($agendas, $tomorrow, $visitMotive->getRefVisitMotiveId()); $firstAvailability = $availabilities[0]; $firstSlot = $firstAvailability->getSlots()[0]; $doctolib->setSessionId('YOUR_SESSION_ID'); $patient = $doctolib->getMasterPatient(); $appointment = $doctolib->createAppointment($booking, $visitMotive, $firstSlot); $appointment = $doctolib->confirmAppointment($appointment, $patient); $upcomingAppointments = $doctolib->getUpcomingAppointments(); $appointment = $doctolib->getAppointment('APPOINTMENT_ID'); $doctolib->deleteAppointment('APPOINTMENT_ID');
Framework integrations
Symfony
Add this block in your services.yaml
file to register the Client
as a service.
Doctolib\Client: arguments: $serializer: '@doctolib.serializer' doctolib.serializer: class: Symfony\Component\Serializer\SerializerInterface factory: ['Doctolib\SerializerFactory', 'create']
Examples
You can find some examples in the examples directory.
You can also check this project julienbornstein/doctolib-autobooking
Testing
$ make test
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.