-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing gitignore and writing the Readme.
- Loading branch information
1 parent
7d49a7d
commit c64ad86
Showing
2 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
/.idea/ | ||
/vendor/ | ||
vendor/ | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,40 @@ | ||
# making-sessions | ||
Library for organizing list of events in sessions | ||
# MakingSessions | ||
This library has one goal: **organizing list of events in sessions**. You can add "events" with a start and end or, a duration. This library is made for separating the events for types of events. | ||
|
||
The origin of this library is sort the actions when I work, each project is a different type of event. With this library now I can see how much time work in each project. | ||
|
||
#Using the library | ||
You start initialising the _Maker_ class and adding the events: | ||
|
||
use Marioquartz\MakingSessions\Maker; | ||
use Marioquartz\MakingSessions\Event; | ||
|
||
$maker=new Maker(); | ||
foreach ($json as $item) { | ||
$event=new Marioquartz\MakingSessions\Event(); | ||
$event | ||
->setStart($start) //start can be a timestamp or a DateInmutable | ||
->setDuration(60) | ||
->setType("example"); | ||
$maker->add($event); | ||
} | ||
|
||
Generate the list of sessions with their events is easy: | ||
|
||
$sessions=$maker->getSessions(); | ||
|
||
Sessions now have a list of sessions, that can be iterated: | ||
|
||
foreach($sessions as $sessiong) { | ||
echo $session->getStart(); // Start of the session returned as timestamp | ||
echo $session->getEnd(); //End as timestamp | ||
echo $session->getDuration() // Duration in seconds | ||
echo $session->getType(); // Type of the events inside | ||
foreach ($session->getEvents() as $event) { | ||
//events have the same functions: getStart(), getEnd(), getDuration() and getType() | ||
} | ||
} | ||
|
||
# Helping | ||
This is my first real library. I don't have much experience, so of course this library have a big room for make better code or usefulness. | ||
If you are a kind person, and you think have an idea or if you have a bug im all ears. |