Download the PHP package binary-cats/coordinator without Composer

On this page you can find all versions of the php package binary-cats/coordinator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package coordinator

Coordinator

Coordinator is a generic resource booking system for Laravel, built with simplicity in mind. It will allow you to book (or schedule) resources using simple intuitive API.

https://github.com/binary-cats/coordinator/actions https://github.styleci.io/repos/358098480 https://scrutinizer-ci.com/g/binary-cats/coordinator/

The package is built with expectations that you would probably extending it for you own needs, so very few conventions are used. Please make sure to familiarize yourselves with the concepts.

Installation

You can install the package via composer:

The Service Provider will automatically register itself and add the following configuration to your Laravel installation:

To change anything in the setup, you can publish the config file using

Config file will be published at config/coordinator.php:

Migration

Running the following will publish a single migration for bookings table:

Concepts

The package provides you with a single model: Booking.

Booking Model

Booking is a single record that ties together bookable resource, like a Room or Table or TechSupport and the model that books the resource. Since the word book is present in every word, it may be hard to grasp right away. In essence, Booking is a pivot model, that has two polymorphic keys: model which represents the owner of the relationship and resource, representing, well, a resource we want to book.

A simple example, perhaps, will help:

When a customer wants to rent an room, we have a relationship between a Customer and a Resource they want.

Customer is a model and a Room is a resource and their relationship is stored as a Booking.

Availability

It is not expected that you may want to have overlapping booking of resources, but nothing should stop you from trying!

There are legitimate use cases when you may want to create two bookings and whomever confirms first, gets the slot and the other gets cancelled.

Coordinator will not try to force your hand, but that means that you need to implement this logic yorself.

Usage

Let's prepare our models. First, the resource that can be booked:

Notice that Resource is implementing BinaryCats\Coordinator\Contracts\BookableResource.

Now, a model that books resources:

Notice that Model is implementing BinaryCats\Coordinator\Contracts\CanBookResources.

Just like with notifications, you should not be bound by thinking "it is a user that books something". Any model can be booking any other resource; a Driver user can be booked by a Delivery for instance.

Coordinator offers fluent interface to create a booking, that can be used on either side of the relation:

and

will produce identical result.

Checking availability

Bookable resource provides means of checking if it is available or booked at a given moment:

To check if the Room is available at a given moment with isAvailableAt. The first argument can be any implementation of DateTimeInterface that can be converted to Carbon\Carbon instance, a string or even a Period:

To check if the Room is available on '2021-01-01', you can use isAvailableAt:

You can pass the second argument to account for the bookings that are canceled:

You can check if the Room is booked at a given moment with isBookedAt:

You can pass the second argument to account for the bookings that are canceled:

Advanced usage

You can check if the Resource is booked or available against a period as well. When doing so, you need to make sure you are comparing period with the same precision. The easiest way is to simply rely on the setting of the Coordinator itself:

By default Coordinator will look for SECOND as precison. You can change that by updating coordinator.precision config key. More about period calculations here;

You can also check if the Resource is available for a given Model. However, since this is more of a policy concern, you need to provide closure resolution logic. For example, you may want to defer to authorization logic using a Gate:

or anything else:

Changelog

Please see CHANGELOG for more information about what has changed recently.

Testing

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using issue tracker.

Postcardware

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Credits

Support us

Binary Cats is a webdesign agency based in Illinois, US.

License

The MIT License (MIT). Please see License File for more information.


All versions of coordinator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/support Version ^8.0|^9.0
spatie/laravel-package-tools Version ^1.0
spatie/period Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package binary-cats/coordinator contains the following files

Loading the files please wait ....