easyweek / craft-booking
Online appointment booking for Craft CMS with EasyWeek: a floating Book now button on every page and a booking form for your Twig templates.
Package info
github.com/easyweek/craft-booking-plugin
Type:craft-plugin
pkg:composer/easyweek/craft-booking
Requires
- php: >=8.2
- craftcms/cms: ^5.0.0
Requires (Dev)
- craftcms/ecs: dev-main
- craftcms/phpstan: dev-main
- phpstan/phpstan: ^2.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Craft CMS plugin that adds EasyWeek online appointment booking to your site: a floating "Book now" button on every page, a booking form for your Twig templates, a full booking page, and booking links. Clients book a service, a specialist and a free time without leaving your site.
- Plugin handle:
easyweek-booking, Composer packageeasyweek/craft-booking - Widget reference: Booking widget for developers
- Other ways to add the widget: easyweek/widget-example-integration
Install
-
Install the plugin: open the Plugin Store in the control panel, search for EasyWeek Booking and install it. Or from the terminal:
composer require easyweek/craft-booking php craft plugin/install easyweek-booking
-
Copy your booking link from your EasyWeek account: Integrations and Apps › Booking Widget. It looks like
https://booking.easyweek.io/your-company. -
Paste it into Booking link in Settings › Plugins › EasyWeek Booking and save.
The floating "Book now" button now shows in the corner of every page of the site. A click opens the booking form on top of the page. Nothing is added to the control panel.
Settings
Settings › Plugins › EasyWeek Booking.
| Setting | Key | Default | What it does |
|---|---|---|---|
| Booking link | url |
empty | Your EasyWeek booking link, starts with https://. Empty switches the widget off |
| Floating button | floatingButton |
on | Show the booking button in the corner of every page |
| Button text | buttonText |
Book now | The label of the button |
| Show the text next to the icon | showText |
on | Off shows the round icon only |
| Button position | position |
right |
right for bottom right, left for bottom left |
| Button colour | buttonBackground |
empty | A hex colour such as #58B44B; empty keeps the EasyWeek green |
A link that does not start with https://, an empty button text or a colour that is not a hex colour is not saved: the field shows what to correct and the saved settings stay as they were.
Config file
Like every Craft plugin, the settings can be set per environment in config/easyweek-booking.php, with the keys of the table:
<?php use craft\helpers\App; return [ 'url' => App::env('EASYWEEK_BOOKING_LINK'), ];
A setting from the config file is locked in the control panel, with a note under the field. The form does not check such a value: when it is not valid, the widget stays off and storage/logs gets a warning that says what to correct. A variable that is not set leaves the link empty, which switches the widget off.
Booking form in a template
Craft renders every page from your own Twig templates, so the plugin gives you a template function instead of a block or a field type.
| Call | Shows |
|---|---|
{{ craft.easyweekBooking.form() }} |
The booking form inside the page |
{{ craft.easyweekBooking.form({type: 'page'}) }} |
The booking form over the full height of the screen, for a separate booking page |
{{ craft.easyweekBooking.form({type: 'button', text: 'Book now'}) }} |
A link that opens the booking form on top of the page. With a url of its own the link leads to that booking page |
{{ craft.easyweekBooking.form({url: 'https://booking.easyweek.io/your-company/123/456'}) }} |
A location or a service straight away |
{{ craft.easyweekBooking.form({width: 400, height: 700}) }} |
The embedded form in another size |
| Option | Default | What it does |
|---|---|---|
type |
embed |
embed, page or button |
url |
the saved booking link | Any booking link format: a location, a service, a specialist, a gift card, a membership |
width, height |
550, 600 | The size of the embedded form in pixels |
text |
Book now | The text of the link, for button |
title |
Online booking | The title of the form for screen readers |
To let editors choose the form per entry, add fields of your own, for example a Dropdown with the values embed, page and button and a Link field, and pass them on:
{{ craft.easyweekBooking.form({
type: entry.bookingFormType,
url: entry.bookingLink,
}) }}
Field values go straight in, and an option that is empty takes its default: an empty Link field shows the saved booking link.
An option the form does not know, or a value it cannot use, throws an exception that names the option.
Any element of your templates with the class easyweek-booking-button opens the booking form too, for example a menu item.
Good to know
- Where the scripts go. The plugin registers the widget with
registerJsFile()andregisterJs()for the end of the body. Craft prints them before</body>, or where your layout calls{{ endBody() }}. A template without</body>, for example one that returns JSON, gets nothing. - Who sees messages. When a form has no valid booking link, visitors see nothing. A signed-in administrator sees a short note in its place.
- Several sites. Craft keeps the settings of a plugin once per project, so every site of a multi-site install gets the same button. The default text and title of the form follow the language of the site. For another booking link on one site, pass
urlin its templates. - Content-Security-Policy. Craft sends no Content-Security-Policy on site pages. If your web server or another plugin does, allow the host of your booking link in
script-srcandframe-src. The widget adds its own style element to the page, so a policy that forbids inline styles has to allow it as well. - Uninstall. Uninstalling the plugin removes its settings from the project config. Take the
craft.easyweekBookingcalls out of your templates first.
Requirements
Craft CMS 5.0 or newer, PHP 8.2 or newer, an EasyWeek account (online booking is part of every plan, the free one included). Tested on Craft CMS 5.12.4 with PHP 8.3.37 and MariaDB 11.8.10: install, settings, the three forms, uninstall.
Privacy
The plugin stores only its settings. The booking form and widget.js load from EasyWeek, the host of your booking link: when a visitor opens a page with the widget, their browser requests them from that host. When the address of a page carries campaign parameters (UTM tags, gclid), the widget script keeps them in the local storage of the visitor's browser under the key ew_tracking and passes them to the booking form, so that you see where a booking came from. Terms and policies: easyweek.io/business/terms-and-policies, privacy: easyweek.io/business/privacy.
About EasyWeek
EasyWeek is online booking and business management software for service businesses: beauty salons, barbershops, nail and lash studios, massage and spa, clinics, fitness and yoga studios, schools and rentals. More than 50,000 users run their bookings, clients, payments and reminders in it. All features: github.com/easyweek and easyweek.io/business/features. Support: support.easyweek.io.
More from EasyWeek on GitHub
- easyweek/widget-example-integration: every way to install the widget, with a live demo
- easyweek/wordpress-booking-plugin: WordPress plugin with a shortcode and a floating button
- easyweek/booking-widget-react: React and Next.js
- easyweek/easyweek-mcp: connect EasyWeek to Claude, ChatGPT and Cursor
- easyweek/agent-skills: skills for Claude Code, Cursor and Codex
License
MIT. Copyright EasyWeek GmbH. EasyWeek is a registered trademark of EasyWeek GmbH.