kamaro/timetable

A package to generate weekly timetable

dev-master / 1.0.x-dev 2019-07-11 16:36 UTC

This package is auto-updated.

Last update: 2024-11-12 04:27:02 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

This package helps you to generate a School time table by providing courses, number of hours and teacher per course. It can be used for other purpose, but initially it was build just for schools

Structure

build/
docs/
config/
src/
tests/
vendor/

Requirements

>= php 7.2

Install

Via Composer

$ composer require kamaro/timetable

Features

  • Course
    • Course Name
    • Teacher name
    • Maximum Hours per Day
    • Maximum Hours per Week.
  • Timer
    • Start Day
    • End Day
    • Start Hour
    • End Hour
  • TimeTable
    • Generate empty Time Table
    • Generate TimeTable
    • Set break time (TBD)
    • set Weekly break days(TBD);

Usage

    use Kamaro\TimeTable\Course;
    use Kamaro\TimeTable\TimeTable;
    use Kamaro\TimeTable\TimeFrame;

    // Generate fake courses
    $courses = [];
    for ($i = 0; $i < 10; ++$i) {
        $course = new Course();
        $course->setCourseName($fake->name);
        $course->setTeacherName($fake->name);
        $course->setMaxHoursPerDay(2);
        $course->setMaxHoursPerWeek(10);
        $courses[] = $course;
    }
    // Generate TimeTable
    $timeTable = (new TimeTable(
                            new TimeFrame() // TimeFrame
                        )
                 )->getTimeTable($courses);

    echo json_encode($timeTable);

Will output below time table

{
  "monday": {
    "8": {
      "hour": "8:00",
      "course": "Dr. Keven Spencer MD",
      "teacher": "Rita Reynolds"
    },
    "9": {
      "hour": "9:00",
      "course": "Dr. Keven Spencer MD",
      "teacher": "Rita Reynolds"
    },
    "10": {
      "hour": "10:00",
      "course": "Prof. Talon Wuckert DVM",
      "teacher": "Melba Hammes"
    },
    "11": {
      "hour": "11:00",
      "course": "Prof. Talon Wuckert DVM",
      "teacher": "Melba Hammes"
    },
    "12": {
      "hour": "12:00",
      "course": "Krystel Veum",
      "teacher": "Lily Smitham"
    },
    "13": {
      "hour": "13:00",
      "course": "Krystel Veum",
      "teacher": "Lily Smitham"
    },
    "14": {
      "hour": "14:00",
      "course": "Sarina Flatley II",
      "teacher": "Prof. Pasquale Fritsch"
    },
    "15": {
      "hour": "15:00",
      "course": "Sarina Flatley II",
      "teacher": "Prof. Pasquale Fritsch"
    },
    "16": {
      "hour": "16:00",
      "course": "Sandrine Wiegand",
      "teacher": "Henriette Kertzmann"
    },
    "17": {
      "hour": "17:00",
      "course": "Sandrine Wiegand",
      "teacher": "Henriette Kertzmann"
    },
    "18": {
      "hour": "18:00",
      "course": "Jimmie Fritsch",
      "teacher": "Mrs. Leonora Hill Jr."
    }
  },
  "tuesday": {
    "8": {
      "hour": "8:00",
      "course": "Dr. Keven Spencer MD",
      "teacher": "Rita Reynolds"
    },
    "9": {
      "hour": "9:00",
      "course": "Dr. Keven Spencer MD",
      "teacher": "Rita Reynolds"
    },
    "10": {
      "hour": "10:00",
      "course": "Prof. Talon Wuckert DVM",
      "teacher": "Melba Hammes"
    },
    "11": {
      "hour": "11:00",
      "course": "Prof. Talon Wuckert DVM",
      "teacher": "Melba Hammes"
    },
    "12": {
      "hour": "12:00",
      "course": "Krystel Veum",
      "teacher": "Lily Smitham"
    },
    "13": {
      "hour": "13:00",
      "course": "Krystel Veum",
      "teacher": "Lily Smitham"
    },
    "14": {
      "hour": "14:00",
      "course": "Sarina Flatley II",
      "teacher": "Prof. Pasquale Fritsch"
    },
    "15": {
      "hour": "15:00",
      "course": "Sarina Flatley II",
      "teacher": "Prof. Pasquale Fritsch"
    },
    "16": {
      "hour": "16:00",
      "course": "Sandrine Wiegand",
      "teacher": "Henriette Kertzmann"
    },
    "17": {
      "hour": "17:00",
      "course": "Sandrine Wiegand",
      "teacher": "Henriette Kertzmann"
    },
    "18": {
      "hour": "18:00",
      "course": "Jimmie Fritsch",
      "teacher": "Mrs. Leonora Hill Jr."
    }
  }

Change log

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

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email kamaroly@gmail.com instead of using the issue tracker.

Credits

License

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