Bilemo is a PHP API built with Symfony that provides an interface to manage Clients, Customers and Phones data. It provides Docker support, database fixtures and various utility scripts for easy setup and teardown, as well as automated tests.
RESTful API endpoints for Clients, Customers and Phones. JWT Authentication. Data fixtures for easy testing. Dockerized setup for isolated development environment. Integrated with Doctrine ORM for efficient database operations. Self-discoverable API endpoints and documentation with NelmioApiDocBundle.
clone the repository
git clone https://github.com/user/bilemo.git
Then navigate into the project directory:
bash
cd bilemo
Next, install the PHP dependencies using Composer:
composer install
Copy .env to .env.local and update your database credentials.
You will need to update the scripts to match your local setup. The scripts are provided as an example and may not work out of the box.
DATABASE_URL="postgresql://app:!ChangeMe!@database:5432/app?serverVersion=15&charset=utf8"
DATABASE_URL="mysql://root:root@127.0.0.1:3306/bilemo?serverVersion=5.7"
Update the same for the test environment in .env.test:
env
DATABASE_URL="postgresql://app:!ChangeMe!@database_test:5432/test_db"
DATABASE_URL="mysql://root:root@127.0.0.1:3306/bilemo?serverVersion=5.7"
Bilemo is Docker ready. To launch the Docker environment, you can use provided script files:
./start.ps1
./start.sh
You can also manage the Docker environment manually:
To build and run the Docker image:
docker-compose up -d
To stop and remove containers, networks and volumes:
docker-compose down
Bilemo is built with testing in mind. You can run tests using the following command:
php ./vendor/bin/phpunit --colors --testdox
docker-compose -f docker-compose.test.yml exec php ./vendor/bin/phpunit --colors --testdox
For the tests, change your doctrine configuration based on your environment in config/packages/doctrine.yaml:
php ./vendor/bin/phpunit --colors --testdox --filter '/::testGetAllCustomersOfTheAdminClient$/'
docker-compose -f docker-compose.test.yml exec php ./vendor/bin/phpunit --colors --testdox --filter '/::testGetAllCustomersOfTheAdminClient$/'
when@test: doctrine: dbal: dbname_suffix: '_test%env(default::TEST_TOKEN)%'
when@test: doctrine: dbal: url: '%env(resolve:DATABASE_URL)%' # Use a separate test database
You can import the Postman collection and environment from the postman directory to test the API endpoints. Go to your postman, click on import and select the postman json directory at the root of the project. You will see the collection and environment imported.