PHP code example of julienbornstein / doctolib-php
1. Go to this page and download the library: Download julienbornstein/doctolib-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
julienbornstein / doctolib-php example snippets
$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');