Download the PHP package vinelab/oclock without Composer
On this page you can find all versions of the php package vinelab/oclock. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vinelab/oclock
More information about vinelab/oclock
Files in vinelab/oclock
Package oclock
Short Description Laravel package that reports scheduled events.
License MIT
Informations about the package oclock
OClock
Explore the details of scheduled events in a Laravel application.
What is this?
There are times when you have too many schedules registered to run at different times, be it in the same application or multiple applications, i.e. in a micro-services architecture where multiple services have their work scheduled to perform different events at different times, it becomes crucial to have one central place that can navigate these scheduled events from across the different applications (services, projects, etc.). The way OClock achieves this is as follows:
Definitions
- Source: The application/project where the events have been defined and scheduled.
- Event: Is a scheduled event that includes the command and Cron expression that defines its running schedule.
- Session: A single run of a scheduled Event. i.e. if an Event is scheduled to run every five minutes each of these runs throughout the day is a Session.
- Schedule: A collection of Events with their Source information.
- Send the session output to a file where we can read them later
- Set the
before
hook on each of the events to store their session information in the database every time they start. - Set the
after
hook on each of the events to:- update their session information and mark the session as done, meanwhile the running status flag
is_running
will be marked astrue
. - Read the session output from the file and add it to the Session record in the database
- Remove the file
- update their session information and mark the session as done, meanwhile the running status flag
Requirements
Installation
Configuration
- Add the service provider
OClock\OClockServiceProvider::class,
to theproviders
array inconfig/app.php
-
Add the mongodb configuration to
config/database.php
as follows: - Update
.env
file with the correct parameters
Usage
Setup
- In the
schedule
method ofapp/Console/Kernel.php
add the following to the bottom (after all the schedules have been defined):
Make sure you import the facade by adding use OClock;
to the top of the file.
Methods
OClock::sessions
: Get all the stored sessionsOClock::sessionsByDay
: Get all the sessions grouped by dayOClock::sessionsForEvent($eventId)
: Get the sessions for the given event
All versions of oclock with dependencies
predis/predis Version ^1.1
jenssegers/mongodb Version ^3.1
illuminate/console Version ^5.3
illuminate/support Version ^5.3