Skip to content

Commit

Permalink
fixing gitignore and writing the Readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
marioquartz committed Jun 26, 2021
1 parent 7d49a7d commit c64ad86
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/.idea/
/vendor/
vendor/
composer.lock
42 changes: 40 additions & 2 deletions README.md
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.

0 comments on commit c64ad86

Please sign in to comment.