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.
- PHP 7.4 or later.
- PHP cURL extension (Usually included with PHP).
Install it using Composer:
$ composer require julienbornstein/doctolib-php
$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');
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']
You can find some examples in the examples directory.
You can also check this project julienbornstein/doctolib-autobooking
$ make test
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.