/file-consumer-command

A basic Symfony command to consume a text file from a public URL

Primary LanguagePHP

File Consumer Command

Build Status CircleCI Dependency Status

A Symfony 4 command to display the most frequent words and their occurence using limit.

Table of contents

Prerequisites

Tools required
  • Docker CE for Windows, Docker CE for Linux or Docker CE for MAC installed
  • Docker Compose installed
Set up the docker stack

Install and start the Docker stack.

The docker stack is composed by 2 containers : php7 (latest) and nginx. All the configuration is done.

Using Docker CE :

docker-compose build

then

docker-compose up -d

You only need this command. It will start the containers (php7, nginx).

Setting www-data as owner of the files.

Set www-data user and group as owner of the files inside the project. Connect to the php container with the root user using this command

docker-composer exec php bash

When you are in the bash run

chown -R www-data:www-data .

Exit from the bash

exit
Install the vendors

Connect to the php container with the www-data user:

docker-compose exec -u www-data php composer install

How to use

Display the most frequent words using limit

Connect to the php container with the www-data user:

docker-compose exec -u www-data php bin/console app:consume-file flatland.txt 100

We actually use a file located at the root folder of this application but you can use any url targeting a file.

Testing

Run the tests
  1. Unit tests

Just run

./bin/phpunit tests/Unit
  1. All tests

Just run

./bin/phpunit