BileMo API provides access to a catalog of high-end mobile phones.
-
Clone the repository:
git clone https://github.com/meline-p/bilemo.git cd bilemo
-
Install dependencies with Composer:
composer install
-
Configure the environment by copying the
.env
file:cp .env .env.local
-
APP_SECRET
: Generate a random secret keyphp bin/console secrets:generate-keys
-
DATABASE_URL
: Database connection URL. -
JWT Token: Create a
jwt
folder inconfig
directory. In your GitBash terminal, generate a private and public key: private key:openssl genpkey -out config/jwt/private.pem -aes256 -algorithm rsa -pkeyopt rsa_keygen_bits:4096
public key:
openssl pkey -in config/jwt/private.pem -out config/jwt/public.pem -pubout
Change
JWT_PASSPHRASE
to your passphrase
Ensure these parameters are configured in the .env.local
file.
-
Update the database:
php bin/console doctrine:migrations:migrate
-
(Optional) Load test data:
php bin/console doctrine:fixtures:load
- Start the local server:
symfony serve
-
This API uses
TagAwareCacheInterface
for cache management. To clear or invalidate the cache by tag, you can use the following command:php bin/console cache:clear
-
Or to invalidate a specific tag:
$cachePool->invalidateTags(['your_tag']);
JWT tokens are employed to protect the API routes.
-
To generate a JWT token after authentication, send a POST request to:
POST /api/login_check
-
Add the token to the Authorization header to access protected endpoints:
Authorization: Bearer your_jwt_token
The API is documented using NelmioApiDocBundle
.
After starting the server, the documentation is available at: http://localhost:8000/api/doc
- GET
/api/products
- GET
/api/products/{id}
- GET
/api/users
- POST
/api/users
- GET
/api/users/{id}
- PUT
/api/users/{id}
- DELETE
/api/users/{id}