Giter Site home page Giter Site logo

ml's Introduction

ML Test

Usage

Start by copying .env.example to .env, if running this via docker you
shouldn't need make any changes.

Run composer install.

To bring up the docker containers run:

docker-compose up -d --build  

Once the containers are up and running you can import the SQL into MySQL by running:

docker exec -i api-mysql sh -c 'exec mysql -uroot -p"password"' < data.sql  

Finally run the following command to create the Doctrine ORM proxy classes:

docker exec -it -w /app api-ml ./vendor/bin/doctrine orm:generate-proxies  

Next checkout the https://github.com/pmill/ml-ui project to experience the UI.

Tests

To run unit tests execute the following command:

./vendor/bin/phpunit  

General Requirements

When creating a subscriber email must be in valid format and host domain must be active

The validation rules for the create subscriber request can be found in the CreateSubscriberValidator validator class. The code to validate the host domain can be found in the EmailHostValidationRule validation rule class

No framework but you can use packages

This project does not use a framework but pulls in some commonly used packages for routing, dependency injection, ORM, validation, and caching.

Use of relationships

The database tables for this project make use of relationships, these are modelled in the code.

Validate request before calling the controller

The request validators are defined on the routes (in routes/api.php), the custom router takes care of validating the requests before instantiating and calling the controller. Another way to do this would've been to use implement a middleware system like Laravel and other frameworks use.

Optional: Redis for caching

Redis is used to cache the DNS results in the EmailHostValidationRule validator rule class.

Optional: Write some tests

I've added a sample of unit tests in the tests/ folder, please do let me know if you'd like me to expand/add to these.

ml's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.