PHPackages                             gasparteixeira/api-boilerplate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. gasparteixeira/api-boilerplate

ActiveProject[HTTP &amp; Networking](/categories/http)

gasparteixeira/api-boilerplate
==============================

Boilerplate to create a REST API with Symfony 4.2

1.0.5(7y ago)550[1 issues](https://github.com/gasparteixeira/api-boilerplate/issues)MITPHPPHP ^7.1.3

Since Mar 5Pushed 7y ago2 watchersCompare

[ Source](https://github.com/gasparteixeira/api-boilerplate)[ Packagist](https://packagist.org/packages/gasparteixeira/api-boilerplate)[ RSS](/packages/gasparteixeira-api-boilerplate/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (27)Versions (5)Used By (0)

API BOILERPLATE Symfony 4.2, MySQL &amp; JWT Authentication
-----------------------------------------------------------

[](#api-boilerplate-symfony-42-mysql--jwt-authentication)

This project is to help people to start a fast API

### Requirements

[](#requirements)

PHP, MySQL, Git, Composer, openssl

> Symfony has a *build-in web server* you do not need Apache or Ngnx to run this project. Thanks Symfony :)

### Install with composer

[](#install-with-composer)

> Change (my-project-name) with the name of your project

```
$ composer create-project gasparteixeira/api-boilerplate my-project-name
```

### Check it out

[](#check-it-out)

```
cd my-project-name
$ php bin/console cache:clear
```

### Environment

[](#environment)

1. Open the file .env and configure your database connection (user, password and database\_name)

```
DATABASE_URL=mysql://user:password@127.0.0.1:3306/database_name
```

2. For security reasons, change this password

```
JWT_PASSPHRASE=boilerplate #change this password name and use the same password when you are generating the ssh keys
```

3. Basic Auth, change username and password

```
// config/services.yml
parameters:
    app_username: boilerplate
    app_password: S3cr37W0rd
```

### Generate SSH keys

[](#generate-ssh-keys)

> use the same password you defined in .env, when asked for it

```
$ mkdir -p config/jwt # For Symfony3+, no need of the -p option
$ openssl genrsa -out config/jwt/private.pem -aes256 4096
$ openssl rsa -pubout -in config/jwt/private.pem -out config/jwt/public.pem
```

### Creating database

[](#creating-database)

> execute the command line to create your database

```
$ php bin/console doctrine:database:create
```

> make migrations

```
$ php bin/console make:migration
```

> lets commit the migration (it will create a table called user)

```
$ php bin/console doctrine:migrations:migrate
```

### Load fixtures

[](#load-fixtures)

> add an user (src/DataFixtures/UserFixtures) to make the test

```
$ php bin/console doctrine:fixtures:load
```

### Running

[](#running)

```
$ php bin/console server:run
```

### Testing

[](#testing)

> You can test it using Postman or through the terminal with curl using the username and password you defined in config\\services.yml

```
curl -X POST -H "Authorization: Basic $(echo -n api@boilerplate.com:12345 | base64)" http://localhost:8000/api/token
```

> Response must start like:

```
{ "token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE1NTE4MjAwNzEsImVtYWlsIjo.. " }
```

### PHPUnit

[](#phpunit)

```
$ php bin/phpunit
```

### API documentation

[](#api-documentation)

> Go to More stuff check out

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

2623d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b6d6f946fa6cbdddca4723b43f78840f68d3276eee37ee83d5641e61259894e?d=identicon)[gasparteixeira](/maintainers/gasparteixeira)

---

Top Contributors

[![gasparteixeira](https://avatars.githubusercontent.com/u/390818?v=4)](https://github.com/gasparteixeira "gasparteixeira (18 commits)")

---

Tags

jwtapirestboilerplatePHP7symfonfy4

### Embed Badge

![Health badge](/badges/gasparteixeira-api-boilerplate/health.svg)

```
[![Health](https://phpackages.com/badges/gasparteixeira-api-boilerplate/health.svg)](https://phpackages.com/packages/gasparteixeira-api-boilerplate)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M650](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[chameleon-system/chameleon-base

The Chameleon System core.

1026.5k3](/packages/chameleon-system-chameleon-base)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
