Skip to content

Jelvix/Symfony-Code-Sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web API Example with OAuth2 and JWT authorization

This project was created in order to show programming skills of PHP engineers from Jelvix.

  1. Setup and run composer
cd Symfony-Code-Sample 
composer install
  1. Setup connection strings for Mysql and Redis in .env file (or .env.local or .env.(dev|prod|staging) )
DATABASE_URL=mysql://user:pass@127.0.0.1:3306/test_db
REDIS_URL=redis://localhost:6379
  1. Run doctrine migrations
bin/console doctrine:migrations:migrate
  1. Generate public/private keys pair for JWT authorization tokens signing
openssl genpkey -algorithm RSA -out ./cfg/jwt_private_key.pem -pkeyopt rsa_keygen_bits:2048

#extract public key
openssl rsa -pubout -in ./cfg/jwt_private_key.pem -out ./cfg/jwt_public_key.pem
  1. Optional: load dummy data to DB for test or development purposes using fixtures
bin/console doctrine:fixtures:load
  1. Run dev server
bin/console server:run

To see full list of additional supported commands run:

bin/console

Generate new entity and create migration

# create new entity
bin/console make:entity 

# generate new migration
bin/console make:migration 

# apply migration
bin/console doctrine:migrations:migrate 

Testing

Run tests

bin/phpunit

Webpanel deployment

  1. Install all the webpanel dependencies
cd webpanel
npm install
  1. run dev server
npm start

or

ng serve
  1. build code
npm build

or

ng build

Production build

To build for production run symfony command

bin/console app:webpanel:build --prod=1

Built files will be placed to configuration file config/packages/webpanel.yaml. After build process is finished, webpanel will be available on default Symfony route http://domain_name/

See all available API

To see and test all the available API's go to SwaggerUI docs page http://localhost:8000/api/doc

Note: FOR CODE DEMONSTRATION ONLY.

About

This project was created in order to show programming skills of PHP engineers from Jelvix.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors