API Rest project 7 - Bilemo Company supplies to their customers a catalogue of mobile phone via an Rest API
- PHP 8.1.2
- Symfony 6.2
- MySQL 5.7.34
- Clone project with
git clone ttps://github.com/PavelKlimovich/BileMo.git
- Install dependencies with
cd BileMo && composer install
- Rename
.env.local
to.env
and fill up your database configuration example config in MYSQL:DATABASE_URL:
DATABASE_URL="mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7.34&charset=utf8"` - Create database with:
php bin/console doctrine:database:create
(or with symfony Client:symfony console doctrine:database:create
) - Create schema on database with:
php bin/console doctrine:migrations:migrate -n
- Load the fixture with :
php bin/console doctrine:fixtures:load
- Create public and private key for JWT Authentication with :
php bin/console lexik:jwt:generate-keypair
- Fill up your passphrase in your .env example:
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=fdd719e8855fdf770a5141fd0afb817b
- Run the server :
symfony server:start
To test the API you will need a token
Go to http://127.0.0.1:8000/api/doc
"username": [email protected]
,
"password": password