Download the PHP package mael/symfony-api-template without Composer
On this page you can find all versions of the php package mael/symfony-api-template. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mael/symfony-api-template
More information about mael/symfony-api-template
Files in mael/symfony-api-template
Package symfony-api-template
Short Description Preconfigured template to create an API based on the Symfony framework
License MIT
Informations about the package symfony-api-template
Symfony API Template
- Synfony version : 5.1.2
Table of content
- Getting started
- Configuration
- Doctrine
- unit tests
- PHPStan
- JWT Configuration
- First Functional test
- Contributing
- License
Getting Started
Requirements :
PHP 7.2.5
ext-ctype
ext-iconv
ext-json
First create a new project with composer
In the composer.json file, change the name of the project by yours as well as the description and the license.
Configuration
Before you can start your project, you need to do some basic configuration
Doctrine
In the .env
file, modify the DATABASE_URL
by filling in your identifiers (see the Symfony documentation)
Unit tests
Our template provides you with a lot of tools for unit testing, you'll have to configure some things to suit your project
First, in the files WebTestCase.php
and ApiTestCase.php
you need to modify the login information that will be used to log in to a user.
You need to fill in the following variables $username
, $password
and $route
Ex :
PHPStan
We also added PHPStan which allows you to detect errors in your code, you can change the level of detection in the phpstan.neon
file.
You will find PHPStan's documentation via this link https://phpstan.org/
JWT Configuration
We assume that your api will use the LexikJWTAuthenticationBundle
. You will find the configuration in config/packages
First, in the .env
file, modify JWT_PASSPHRAS
E by a string that you will choose
When you do the following two commands, it will ask you to enter the passphrase you previously selected
For JWT authentication to work, you need to generate two :
We have also added a bundle to refresh the JWT token, you will find the documentation here https://github.com/markitosgv/JWTRefreshTokenBundle#readme
You can also configure the route in the config/route.yaml
file.
Be careful, you have to configure the authentication system yourself via JWT, in the security.yaml file (see the bundle documentation https://github.com/lexik/LexikJWTAuthenticationBundle/blob/master/Resources/doc/index.md).
First Functional test
During your first functional tests you will have to generate the sqlite database using the command
Contributing
If you want to contribute to the improvement of the template, you can :
- Fork this repo
- Make your change
- Create pull request
License
This repository is under MIT License
All versions of symfony-api-template with dependencies
ext-ctype Version *
ext-iconv Version *
ext-json Version *
api-platform/api-pack Version ^1.2
gesdinet/jwt-refresh-token-bundle Version ^0.9.1
lexik/jwt-authentication-bundle Version ^2.8
sensio/framework-extra-bundle Version ^5.1
symfony/asset Version 5.1.*
symfony/console Version 5.1.*
symfony/dotenv Version 5.1.*
symfony/expression-language Version 5.1.*
symfony/flex Version ^1.3.1
symfony/form Version 5.1.*
symfony/framework-bundle Version 5.1.*
symfony/http-client Version 5.1.*
symfony/intl Version 5.1.*
symfony/mailer Version 5.1.*
symfony/mime Version 5.1.*
symfony/monolog-bundle Version ^3.1
symfony/notifier Version 5.1.*
symfony/orm-pack Version *
symfony/process Version 5.1.*
symfony/security-bundle Version 5.1.*
symfony/serializer-pack Version *
symfony/string Version 5.1.*
symfony/translation Version 5.1.*
symfony/twig-pack Version *
symfony/validator Version 5.1.*
symfony/web-link Version 5.1.*
symfony/yaml Version 5.1.*