Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • PHP Challenge PHP Challenge
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Jobsity
  • PHP ChallengePHP Challenge
  • Wiki
  • PHP Challenge Instructions

Last edited by Matias Marin May 09, 2024
Page history

PHP Challenge Instructions

Description

This Challenge is designed to test your abilities building backend web projects in PHP. Show us your best skills and knowledge in good practices and standards.

Assignment

The objective of this challenge is to create a REST API application that the user can use to track the value of stocks in the stock market. The base for your application as presented here uses a simple implementation of Slim Framework

You may use the Stooq API service to get latest stock market values. Check the format used below. You can replace the {stock_code} placeholder with the corresponding stock code:

https://stooq.com/q/l/?s={stock_code}&f=sd2t2ohlcvn&h&e=csv

Mandatory Features

  • You will need to record a video explaining the code you created, the decisions you made, its functionality, and demonstrating the complete operation of the challenge. Remember to show the execution from scratch, it should not be running beforehand.

  • The application must use a SQL database to store users and record logs of past requests. Check out the Slim documentation if you would like to use Eloquent, Doctrine or Atlas.

  • The application must be able to authenticate registered users. There's a basic example of authentication used for 1 endpoint, you may need to modify it accordingly based on the requirements. (See: routes.php)

The application must have these three endpoints:

  • An endpoint to create a new User, storing the email and information to log in later.
  • An endpoint to request a stock quote, like this:

GET /stock?q=aapl.us

  {
  "name": "APPLE",
  "symbol": "AAPL.US",
  "open": 123.66,
  "high": 123.66,
  "low": 122.49,
  "close": 123
  }

The same endpoint must additionally send an email with the same information to the user who requested the quote. To send the email, you may use SwiftMailer with the wrapper included, as we detail in this example, or use your own implementation.

  • An endpoint to retrieve the history of queries made to the API service by that user. The endpoint should return the list of entries saved in the database, showing the latest entries first:

GET /history

[
    {"date": "2021-04-01T19:20:30Z", "name": "APPLE", "symbol": "AAPL.US", "open": "123.66", "high": 123.66, "low": 122.49, "close": "123"},
    {"date": "2021-03-25T11:10:55Z", "name": "APPLE", "symbol": "AAPL.US", "open": "121.10", "high": 123.66, "low": 122, "close": "122"},
    ...
]

Bonus features

The following features are optional to implement, but if you do, you'll be ranked higher in our evaluation process.

  • Add unit tests for the endpoints.
  • Use RabbitMQ to send the email asynchronously.
  • Use JWT instead of basic authentication for endpoints.
  • Containerize the app.

Considerations

  • Focus only on the backend. We will not review any frontend functionality for this project.
  • Provide any and all information our evaluators may need. Use seeders instead of SQL dumps if we need any predetermined database information.
  • Provide a detailed Readme with instructions on how to install, use, etc.

Base project

You can find some bootstrap for the challenge with some endpoints, basic setup, and tests. This project uses composer as a package manager, so in order to run the project for the first time you need to follow these next steps:

  • Run composer install, this will install dependencies
  • Copy the .env.sample file into .env and modify its contents to match your current settings.
  • Run composer start and you should be able to check the project running on http://localhost:8080

Optional:

  • Run composer test to see the test suite result
Clone repository
  • PHP Challenge Instructions
  • Usage of the Mailer service (SwiftMailer)
  • Using RabbitMQ with Slim Framework
  • Home