PHPackages                             playground-sessions/php-code-exercise - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. playground-sessions/php-code-exercise

ActiveProject[API Development](/categories/api)

playground-sessions/php-code-exercise
=====================================

An API Coding Exercise.

v1.0.2(5y ago)034MITPHPPHP ^8.0

Since Jan 27Pushed 4y ago4 watchersCompare

[ Source](https://github.com/PlaygroundSessions/php-code-exercise)[ Packagist](https://packagist.org/packages/playground-sessions/php-code-exercise)[ RSS](/packages/playground-sessions-php-code-exercise/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

Playground Sessions Backend Code Exercise (Lumen)
=================================================

[](#playground-sessions-backend-code-exercise-lumen)

Scenario
--------

[](#scenario)

Take this hypothetical situation.

We are making an iOS and Android app for teachers. A teacher will select a student to see all lessons, and whether that student completed each lesson.

Each app will get its data from the JSON REST API endpoint:

```
/student-progress/{userId}

```

Where `{userId}` is the user id of the student.

You inherit this codebase.

You remember how the data is structured:

- Lessons contain several segments.
- A user can create practice records for a segment.

You look over the codebase and realize that several problems exist in this endpoint.

1. Business rules (eg. whether a user has completed a lesson) would be duplicated by each app.
2. It is too slow, even with a reasonable amount of practice records.

Luckily, both front-end developers agree that the endpoint needs to change before it is used. You all agree to the following data structure for the response:

```
{
  "lessons": [
    {
      "id": 32,
      "difficulty": "Rookie",
      "isComplete": true
    }
  ]
}

```

Instructions
------------

[](#instructions)

Solve all problems with this codebase.

- Create a new data structure for the response.
- Codify the following business rules.
    - A lesson is complete if each segment has at least one practice record with a score of 80% or more.
    - Difficulty categories ("Rookie", "Intermediate", "Advanced") are associated with difficulty numbers \[1,2,3\], \[4,5,6\], \[7,8,9\], respectively.
- Ensure the response time for user id 1 is under 500ms for the given dataset. Right now the response time is about 2 seconds.

Code should be cleanly written in self-contained parts, each having one responsibility, according to the Single Responsibility Principle (SRP). For example, application logic (eg. extracting query parameters from a URL) should be separate from business logic (eg. determining whether a lesson is complete).

You have full reign over the codebase. You can add or remove any packages you like. Everything is fair game.

We are testing your ability to organize code cleanly, with SRP, not your knowledge of the Laravel/Lumen frameworks.

Try to commit often and with small changes, so we can see what you are doing.

If you have a particular strength (say documenting APIs), feel free show it off.

You might benefit from knowing that all 3 problems can be solved without use of a cache.

Deliverables
------------

[](#deliverables)

Email  with a link to your git repository.

Getting Started
---------------

[](#getting-started)

Getting started is simple with PHP's built-in web server.

1. Have PHP 8.0 installed.
2. Follow the [Development Environment Setup](readme/built-in-php-server.md)

Go!
---

[](#go)

We look forward to seeing your code!

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

3

Last Release

1919d ago

PHP version history (3 changes)v1.0.0PHP ^7.3|^8.0

v1.0.1PHP ^7.4|^8.0

v1.0.2PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/31b6cf65c0d17dd073ba621e6281544adc69133a6030bdcc884c92c05c0bc189?d=identicon)[bbankes](/maintainers/bbankes)

---

Top Contributors

[![benbankes](https://avatars.githubusercontent.com/u/2132746?v=4)](https://github.com/benbankes "benbankes (52 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/playground-sessions-php-code-exercise/health.svg)

```
[![Health](https://phpackages.com/badges/playground-sessions-php-code-exercise/health.svg)](https://phpackages.com/packages/playground-sessions-php-code-exercise)
```

###  Alternatives

[darkaonline/swagger-lume

OpenApi or Swagger integration to Lumen

3372.3M3](/packages/darkaonline-swagger-lume)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
