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 today

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

26

—

LowBetter than 46% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

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

2576d 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

[oro/platform

Business Application Platform (BAP)

648132.0k74](/packages/oro-platform)[ezsystems/ezplatform

eZ Platform distribution

32641.1k](/packages/ezsystems-ezplatform)[thelia/thelia

Thelia is an ecommerce CMS.

8715.1k](/packages/thelia-thelia)[mapbender/mapbender

Mapbender library

10117.0k5](/packages/mapbender-mapbender)[gointegro/hateoas

GOintegro HATEOAS Lib

418.0k1](/packages/gointegro-hateoas)[ezsystems/ezplatform-ee

eZ Platform Enterprise Edition distribution

225.5k](/packages/ezsystems-ezplatform-ee)

PHPackages © 2026

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