PHP Classes

PHP Bookwhen API: Access booking information using the BookWhen API

Recommend this page to a friend!
  Info   View files Documentation   View files View files (128)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2023-05-10 (10 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 66 This week: 1All time: 10,322 This week: 560Up
Version License PHP version Categories
bookwhen 1.0.0Custom (specified...8Time and Date, Web services, Business, P...
Description 

Author

This package can access booking information using the BookWhen API.

It can send HTTP requests to the BookWhen API Web server to perform several operations related to bookings managed using the BookWhen application.

Currently, it can access:

- Booking file attachments

- Booking class passes

- Events

- Booking locations

- Tickets

Innovation Award
PHP Programming Innovation award nominee
April 2023
Number 3
Many professionals and businesses provide services that need to be booked by customers with anticipation, like, for instance, events, hotel hosting, etc...

The BookWhen application provides booking management services to businesses and customers.

This package provides access to the BookWhen API, so PHP application developers can integrate the BookWhen services into their projects to help manage service booking for their services or the services of their customers.

Manuel Lemos
Picture of Daniel Mullin
  Performance   Level  
Name: Daniel Mullin <contact>
Classes: 1 package by
Country: United Kingdom
Age: ???
All time rank: 4465195 in United Kingdom
Week rank: 416 Up15 in United Kingdom Up
Innovation award
Innovation award
Nominee: 1x

Documentation

inShore.je - Bookwhen PHP API SDK

Latest Version Software License Coverage Status Quality Score Total Downloads

SDK kit for the Bookwhen API.

https://www.bookwhen.com

https://api.bookwhen.com/v2

Install

Requirements

PHP 8.1 and later.

Composer

$ composer require inshore/bookwhen

Usage

Simply expose your Bookwhen API key as the environment property

INSHORE_BOOKWHEN_API_KEY

via .env or how you prefer.

$bookwhen = new Bookwhen();

Attachments

implements https://api.bookwhen.com/v2#tag/Attachment

Attachments

https://api.bookwhen.com/v2#tag/Attachment/paths/~1attachments/get


// Fetch attachments accessible by the API token.

$attachments = $bookwhen->attachments());

Filters

The filter parameters can be passed in as function parameters.

title - Filter on the file title text.

fileName - Filter on the file name.

fileType - Filter on the file type.


// Fetch attachments accessible by the API token.

$attachments = $bookwhen->attachments(fileName: 'CV'));

$attachments = $bookwhen->attachments(fileType: 'pdf'));

$attachments = $bookwhen->attachments(title: 'Title to filter by'));

$attachments = $bookwhen->attachments(fileName: 'CV', fileType: 'pdf', title: 'Title to filter by'));

Attachment

https://api.bookwhen.com/v2#tag/Attachment/paths/~1attachments~1%7Battachment_id%7D/g

// Returns the attachment for the provided attachment ID.

$attachment = $bookwhen->attachment('ev-smij-20200530100000' );

Class Passes

implements https://api.bookwhen.com/v2#tag/ClassPass

ClassPasses

https://api.bookwhen.com/v2#tag/ClassPass/paths/~1class_passes/get


// Fetch class passes accessible by the API token.

$classPasses = $bookwhen->classPasses());

Filters

The filter parameters can be passed in as function parameters

title - Filter on the title text of the pass.

detail - Filter on the details text.

usageType - Filter on the type of the pass: personal or any.

cost - Filter on the cost with an exact value or use a comparison operator. e.g. filter[cost][gte]=2000

gt - greater than

gte - greater than or equal

lt - less than

lte - less than or equal

eq - equal to

usageAllowance - Filter on pass usage allowance. This also accepts a comparison operator like cost.

useRestrictedForDays - Filter on pass days restriction. This also accepts a comparison operator like cost.


// Fetch class passes accessible by the API token.

$classPasses = $bookwhen->classPasses());

$classPasses = $bookwhen->classPasses(title: 'Title to filter by'));

ClassPass

https://api.bookwhen.com/v2#tag/ClassPass/paths/~1class_passes~1%7Bclass_pass_id%7D/get


// Returns the class pass for the provided class pass ID.

$classPass = $bookwhen->classPass('ev-smij-20200530100000');

Events

https://api.bookwhen.com/v2#tag/Event

Events

https://api.bookwhen.com/v2#tag/Event/paths/~1events/get


// Returns the event for the provided event ID.

$event = $bookwhen->events();

Filters

calendar - Restrict to events on the given calendars (schedule pages).

entry - Restrict to given entries.

location - Array of location slugs to include.

tag - Array of tag words to include.

title - Array of entry titles to search for.

detail - Array of entry details to search for.

from - Inclusive time to fetch events from in format YYYYMMDD or YYYYMMDDHHMISS. Defaults to today.

to - Non-inclusive time to fetch events until in format YYYYMMDD or YYYYMMDDHHMISS

compact - Boolean: Combine events in a course into a single virtual event.

Includes

By default the event will NOT have its attachments, location and tickets populated.

To retrieve an event with the included relationships, simply pass boolean true for the relationship that is required.

includeAttachments includeLocation includeTickets includeTickets.class_passes includeTickets.events

for example to retrieve the event with its location and tickets.


// Returns the event for the provided event ID.

$event = $bookwhen->events(title: 'Title to filter by'));

Event

https://api.bookwhen.com/v2#tag/Event/paths/~1events~1%7Bevent_id%7D/get


// Returns the event for the provided event ID.

$event = $bookwhen->event('ev-smij-20200530100000');


// Returns the event for the provided event ID.

$event = $bookwhen->event(eventId: 'ev-smij-20200530100000', includeLocation: true, includeTickets: true);

Events


// Fetch events accessible by the API token.

$events = $bookwhen->events());

Filters

The event list can be filtered as per the api documentation

Includes

By default the event will NOT have its attachments, location and tickets populated.

To retrieve an event withg the included relationships, simply pass boolean true for the relationship that is required.

includeAttachments includeLocation includeTickets.class_passes includeTickets.events

for example to retrieve the event with its location and tickets.


// Fetch events accessible by the API token.

$events = $bookwhen->events(location: true, includeTickets: true);));

Locations

Implements https://api.bookwhen.com/v2#tag/Location

Locations

https://api.bookwhen.com/v2#tag/Location/paths/~1locations/get


// Fetch events accessible by the API token.

$locations = $bookwhen->locations());

// Returns the location for the provided location ID.

Filters

addressText - Restrict to locations containing the address text filter.

additionalInfo - Filter by the text contained in the additional info.


// Fetch events accessible by the API token.

$locations = $bookwhen->locations(addressText: 'Remote'));

// Returns the location for the provided location ID.

Location

https://api.bookwhen.com/v2#tag/Location/paths/~1locations~1%7Blocation_id%7D/get

// Returns the location for the provided location ID.

$location = $bookwhen->location('ev-smij-20200530100000');

Tickets

Implements https://api.bookwhen.com/v2#tag/Ticket

Tickets

https://api.bookwhen.com/v2#tag/Ticket/paths/~1tickets/get


// Fetch tickets for the given event.

$eventId = 'ev-smij-20200530100000';

$client->tickets($eventId);

Includes

By default the tickets will NOT have its attachments, evetns and location populated.

To retrieve an event withg the included relationships, simply pass boolean true for the relationship that is required.

includeAttachments includeLocation includeTickets.class_passes includeTickets.events


// Fetch tickets for the given event.

$eventId = 'ev-smij-20200530100000';

$client->tickets($eventId, includeAttachments: true);

Ticket

https://api.bookwhen.com/v2#tag/Ticket/paths/~1tickets~1%7Bticket_id%7D/get

// Retrieve a single ticket.

$ticketId = 'ti-sboe-20200320100000-tk1m';

$client->ticket($ticketId);

Includes

By default the tickets will NOT have its attachments, evetns and location populated.

To retrieve an event withg the included relationships, simply pass boolean true for the relationship that is required.

includeAttachments includeLocation includeTickets.class_passes includeTickets.events

// Retrieve a single ticket.

$client->ticket('ti-sboe-20200320100000-tk1m', includeAttachments: true););

Logging

Full syslog level logging is available and can be enabled by passing a level in when instatiating the Client. As illustrated in RFC 5424 which describes the syslog protocol, the following levels of intensity are applied.

DEBUG: Detailed debugging information. INFO: Handles normal events. Example: SQL logs NOTICE: Handles normal events, but with more important events WARNING: Warning status, where you should take an action before it will become an error. ERROR: Error status, where something is wrong and needs your immediate action CRITICAL: Critical status. Example: System component is not available ALERT: Immediate action should be exercised. This should trigger some alerts and wake you up during night time. EMERGENCY: It is used when the system is unusable.

$bookwhen = new Bookwhen()->debug('Debug');

Testing

WIP

$ composer phpunit

Contributing

Please see https://github.com/inshore/bookwhen/blob/develop/CONTRIBUTING.md for details.

Support

If you require assistance with this package or implementing in your own project or business...

https://bookwhen.com/inshore

<script type="text/javascript" src="https://cdnjs.buymeacoffee.com/1.0.0/button.prod.min.js" data-name="bmc-button" data-slug="danielmullin" data-color="#FFDD00" data-emoji="" data-font="Cookie" data-text="Buy me a coffee" data-outline-color="#000000" data-font-color="#000000" data-coffee-color="#ffffff" ></script>

https://www.buymeacoffee.com/danielmullin

Credits

  • Daniel Mullin inshore@danielmullin.com
  • Brandon Lubbehusen inshore@danielmullin.com

This package was heavily influenced by Nuno Maduro and the https://github.com/openai-php/client package.

License

MIT https://github.com/inshore/bookwhen/blob/master/LICENSE.md


  Files folder image Files  
File Role Description
Files folder image.github (1 directory)
Files folder imagesrc (5 files, 9 directories)
Files folder imagetests (3 directories)
Files folder imagetools (4 files, 1 directory)
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file clover.xml Data Auxiliary data
Accessible without login Plain text file clover.xml Data Auxiliary data
Accessible without login Plain text file CODE_OF_CONDUCT.md Data Auxiliary data
Accessible without login Plain text file CODE_OF_CONDUCT.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  .github  
File Role Description
Files folder imageworkflows (2 files)

  Files folder image Files  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file phpunit.yml Data Auxiliary data
  Accessible without login Plain text file phpunit.yml Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageContracts (4 files, 1 directory)
Files folder imageDomain (5 files)
Files folder imageEnums (1 directory)
Files folder imageExceptions (8 files)
Files folder imageInterfaces (3 files)
Files folder imageResources (5 files, 1 directory)
Files folder imageResponses (6 directories)
Files folder imageTransporters (1 file)
Files folder imageValueObjects (2 files, 1 directory)
  Plain text file Bookwhen.php Class Class source
  Plain text file BookwhenApi.php Class Class source
  Plain text file Client.php Class Class source
  Plain text file Factory.php Class Class source
  Plain text file Validator.php Class Class source

  Files folder image Files  /  src  /  Contracts  
File Role Description
Files folder imageResources (5 files)
  Plain text file ClientContract.php Class Class source
  Plain text file ResponseContract.php Class Class source
  Plain text file StringableContract.php Class Class source
  Plain text file TransporterContract.php Class Class source

  Files folder image Files  /  src  /  Contracts  /  Resources  
File Role Description
  Plain text file AttachmentsContract.php Class Class source
  Plain text file ClassPassesContract.php Class Class source
  Plain text file EventsContract.php Class Class source
  Plain text file LocationsContract.php Class Class source
  Plain text file TicketsContract.php Class Class source

  Files folder image Files  /  src  /  Domain  
File Role Description
  Plain text file Attachment.php Class Class source
  Plain text file ClassPass.php Class Class source
  Plain text file Event.php Class Class source
  Plain text file Location.php Class Class source
  Plain text file Ticket.php Class Class source

  Files folder image Files  /  src  /  Enums  
File Role Description
Files folder imageTransporter (2 files)

  Files folder image Files  /  src  /  Enums  /  Transporter  
File Role Description
  Accessible without login Plain text file ContentType.php Aux. Auxiliary script
  Accessible without login Plain text file Method.php Aux. Auxiliary script

  Files folder image Files  /  src  /  Exceptions  
File Role Description
  Plain text file ConfigurationException.php Class Class source
  Plain text file ErrorException.php Class Class source
  Plain text file InshoreBookwhenException.php Class Class source
  Plain text file InvalidArgumentException.php Class Class source
  Plain text file RestException.php Class Class source
  Plain text file TransporterException.php Class Class source
  Plain text file UnserializableResponse.php Class Class source
  Plain text file ValidationException.php Class Class source

  Files folder image Files  /  src  /  Interfaces  
File Role Description
  Plain text file BookwhenInterface.php Class Class source
  Plain text file ClientInterface.php Class Class source
  Plain text file ValidatorInterface.php Class Class source

  Files folder image Files  /  src  /  Resources  
File Role Description
Files folder imageConcerns (1 file)
  Plain text file Attachments.php Class Class source
  Plain text file ClassPasses.php Class Class source
  Plain text file Events.php Class Class source
  Plain text file Locations.php Class Class source
  Plain text file Tickets.php Class Class source

  Files folder image Files  /  src  /  Resources  /  Concerns  
File Role Description
  Plain text file Transportable.php Class Class source

  Files folder image Files  /  src  /  Responses  
File Role Description
Files folder imageAttachments (2 files)
Files folder imageClassPasses (2 files)
Files folder imageConcerns (1 file)
Files folder imageEvents (2 files)
Files folder imageLocations (2 files)
Files folder imageTickets (2 files)

  Files folder image Files  /  src  /  Responses  /  Attachments  
File Role Description
  Plain text file ListResponse.php Class Class source
  Plain text file RetrieveResponse.php Class Class source

  Files folder image Files  /  src  /  Responses  /  ClassPasses  
File Role Description
  Plain text file ListResponse.php Class Class source
  Plain text file RetrieveResponse.php Class Class source

  Files folder image Files  /  src  /  Responses  /  Concerns  
File Role Description
  Plain text file ArrayAccessible.php Class Class source

  Files folder image Files  /  src  /  Responses  /  Events  
File Role Description
  Plain text file ListResponse.php Class Class source
  Plain text file RetrieveResponse.php Class Class source

  Files folder image Files  /  src  /  Responses  /  Locations  
File Role Description
  Plain text file ListResponse.php Class Class source
  Plain text file RetrieveResponse.php Class Class source

  Files folder image Files  /  src  /  Responses  /  Tickets  
File Role Description
  Plain text file ListResponse.php Class Class source
  Plain text file RetrieveResponse.php Class Class source

  Files folder image Files  /  src  /  Transporters  
File Role Description
  Plain text file HttpTransporter.php Class Class source

  Files folder image Files  /  src  /  ValueObjects  
File Role Description
Files folder imageTransporter (4 files)
  Plain text file ApiKey.php Class Class source
  Plain text file ResourceUri.php Class Class source

  Files folder image Files  /  src  /  ValueObjects  /  Transporter  
File Role Description
  Plain text file BaseUri.php Class Class source
  Plain text file Headers.php Class Class source
  Plain text file Payload.php Class Class source
  Plain text file QueryParams.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imagefixtures (13 files)
Files folder imageintegration (20 files)
Files folder imageunit (4 files, 2 directories)

  Files folder image Files  /  tests  /  fixtures  
File Role Description
  Accessible without login Plain text file attachments_200.json Data Auxiliary data
  Accessible without login Plain text file attachment_200.json Data Auxiliary data
  Accessible without login Plain text file classPasses_200.json Data Auxiliary data
  Accessible without login Plain text file classPasses_200.json Data Auxiliary data
  Accessible without login Plain text file classpass_200.json Data Auxiliary data
  Accessible without login Plain text file events_200.json Data Auxiliary data
  Accessible without login Plain text file event_200.json Data Auxiliary data
  Accessible without login Plain text file event_include_location_200.json Data Auxiliary data
  Accessible without login Plain text file event_include_location_200.json Data Auxiliary data
  Accessible without login Plain text file locations_200.json Data Auxiliary data
  Accessible without login Plain text file location_200.json Data Auxiliary data
  Accessible without login Plain text file tickets_200.json Data Auxiliary data
  Accessible without login Plain text file ticket_200.json Data Auxiliary data

  Files folder image Files  /  tests  /  integration  
File Role Description
  Plain text file AttachmentsTest.php Class Class source
  Plain text file AttachmentsTest.php Class Class source
  Plain text file AttachmentTest.php Class Class source
  Plain text file AttachmentTest.php Class Class source
  Plain text file ClassPassesTest.php Class Class source
  Plain text file ClassPassesTest.php Class Class source
  Plain text file ClassPassTest.php Class Class source
  Plain text file ClassPassTest.php Class Class source
  Plain text file EventsTest.php Class Class source
  Plain text file EventsTest.php Class Class source
  Plain text file EventTest.php Class Class source
  Plain text file EventTest.php Class Class source
  Plain text file LocationsTest.php Class Class source
  Plain text file LocationsTest.php Class Class source
  Plain text file LocationTest.php Class Class source
  Plain text file LocationTest.php Class Class source
  Plain text file TicketsTest.php Class Class source
  Plain text file TicketsTest.php Class Class source
  Plain text file TicketTest.php Class Class source
  Plain text file TicketTest.php Class Class source

  Files folder image Files  /  tests  /  unit  
File Role Description
Files folder imageResponses (5 directories)
Files folder imageValueObjects (4 files, 1 directory)
  Plain text file BookwhenTest.php Class Class source
  Plain text file BookwhenTest.php Class Class source
  Plain text file ValidatorTest.php Class Class source
  Plain text file ValidatorTest.php Class Class source

  Files folder image Files  /  tests  /  unit  /  Responses  
File Role Description
Files folder imageAttachments (2 files)
Files folder imageClassPasses (2 files)
Files folder imageEvents (2 files)
Files folder imageLocations (2 files)
Files folder imageTickets (2 files)

  Files folder image Files  /  tests  /  unit  /  Responses  /  Attachments  
File Role Description
  Plain text file RetrieveResponseTest.php Class Class source
  Plain text file RetrieveResponseTest.php Class Class source

  Files folder image Files  /  tests  /  unit  /  Responses  /  ClassPasses  
File Role Description
  Plain text file RetrieveResponseTest.php Class Class source
  Plain text file RetrieveResponseTest.php Class Class source

  Files folder image Files  /  tests  /  unit  /  Responses  /  Events  
File Role Description
  Plain text file RetrieveResponseTest.php Class Class source
  Plain text file RetrieveResponseTest.php Class Class source

  Files folder image Files  /  tests  /  unit  /  Responses  /  Locations  
File Role Description
  Plain text file RetrieveResponseTest.php Class Class source
  Plain text file RetrieveResponseTest.php Class Class source

  Files folder image Files  /  tests  /  unit  /  Responses  /  Tickets  
File Role Description
  Plain text file RetrieveResponseTest.php Class Class source
  Plain text file RetrieveResponseTest.php Class Class source

  Files folder image Files  /  tests  /  unit  /  ValueObjects  
File Role Description
Files folder imageTransporter (2 files)
  Plain text file ApiKeyTest.php Class Class source
  Plain text file ApiKeyTest.php Class Class source
  Plain text file ResourceUriTest.php Class Class source
  Plain text file ResourceUriTest.php Class Class source

  Files folder image Files  /  tests  /  unit  /  ValueObjects  /  Transporter  
File Role Description
  Plain text file BaseUriTest.php Class Class source
  Plain text file BaseUriTest.php Class Class source

  Files folder image Files  /  tools  
File Role Description
Files folder imagephp-cs-fixer (1 file)
  Accessible without login Plain text file RestExceptionTest.php Aux. Auxiliary script
  Accessible without login Plain text file RestExceptionTest.php Aux. Auxiliary script
  Accessible without login Plain text file ValidationExceptionTest.php Aux. Auxiliary script
  Accessible without login Plain text file ValidationExceptionTest.php Aux. Auxiliary script

  Files folder image Files  /  tools  /  php-cs-fixer  
File Role Description
  Accessible without login Plain text file composer.json Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:66
This week:1
All time:10,322
This week:560Up