Website 🚀 contributte.org | Contact 👨🏻‍💻 f3l1x.io | Twitter 🐦 @contributte


# Goal

Main goal is to provide best prepared API starter-kit project for Nette-Apitte developers.

Focused on:

  • latest PHP 8.0
  • postgres & mariadb
  • nette/* packages
  • build PSR-7 API via apitte/*
  • Doctrine ORM via nettrine/*
  • Symfony components via contributte/*
  • codestyle checking via CodeSniffer and ninjify/*
  • static analysing via phpstan
  • unit / integration tests via Nette Tester and ninjify/*

You can try it out yourself either by running it with docker, or more easily with docker-compose.

# Demo

https://examples.contributte.org/apitte-skeleton/ (opens new window)

# Install with docker (opens new window)

  1. At first, use composer to install this project.

    composer create-project -s dev contributte/apitte-skeleton
    
    1
  2. After that, you have to setup database.

    1. Setup PostgreSQL 10. You can start it manually or use docker image dockette/postgres:12.

      docker run -it -p 5432:5432 -e POSTGRES_PASSWORD=apitte -e POSTGRES_USER=apitte dockette/postgres:12
      
      1

      Or use make task, make docker-postgres.

    2. Setup MariaDB 10.4. You can start it manually or use docker image mariadb:10.4.

      docker run -it -d -p 3306:3306 -e MARIADB_ROOT_PASSWORD=apitte -e MARIADB_PASSWORD=apitte -e MARIADB_USER=apitte -e MARIADB_DATABASE=apitte mariadb:10.4
      
      1

      Or use make task, make docker-mariadb.

  3. Custom configuration file is located at config/local.neon. Edit it if you want.

    Default configuration should look like this. Pick PostgreSQL or MariaDB.

    # Host Config
    parameters:
    
    	# Database
    	database:
    
    		# Postgres
    		driver: pdo_pgsql
    		host: database
    		dbname: apitte
    		user: apitte
    		password: apitte
    		port: 5432
    
    		# MariaDB
    		driver: pdo_mysql
    		host: database
    		dbname: apitte
    		user: apitte
    		password: apitte
    		port: 3306
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
  4. Ok database is now running and application is configured to connect to it. Let's create initial data.

    Run NETTE_DEBUG=1 bin/console migrations:migrate to create tables. Run NETTE_DEBUG=1 bin/console doctrine:fixtures:load --append to create first user(s).

    Or via task make build.

  5. Start your devstack or use PHP local development server.

    You can start PHP server by running php -S localhost:8000 -t www or use prepared make task make dev.

  6. Open http://localhost (opens new window) and enjoy!

    Take a look at:

# Install with docker compose (opens new window)

  1. At first, use composer to install this project.

    composer create-project -s dev contributte/apitte-skeleton
    
    1
  2. Modify config/local.neon and set host to database

    Default configuration should look like this. There is preconfigured database. Pick PostgreSQL or MariaDB.

    # Host Config
    parameters:
    
    	# Database
    	database:
    
    		# Postgres
    		driver: pdo_pgsql
    		host: database
    		dbname: apitte
    		user: apitte
    		password: apitte
    		port: 5432
    
    		# MariaDB
    		driver: pdo_mysql
    		host: database
    		dbname: apitte
    		user: apitte
    		password: apitte
    		port: 3306
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
  3. Run docker-compose up

  4. Open http://localhost (opens new window) and enjoy!

    Take a look at:

# (Optional) REST API documentation

Since we have OpenAPI specification available at /api/public/v1/openapi/meta you just need to add UI for it (e.g. to www/doc directory or as a standalone application).

Available options are:

# Features

Here is a list of all features you can find in this project.

  • PHP 8.0+
  • 📦 Packages
    • Nette 3+
    • Apitte
    • Contributte
    • Nettrine
  • 🌳 Structure
    • app
      • config - configuration files
        • env - prod/dev/test environments
        • app - application configs
        • ext - extensions configs
        • local.neon - local runtime config
        • local.neon.dist - template for local config
      • domain - business logic and domain specific classes
      • model - application backbone
      • module - API module
      • resources - static content for mails and others
      • bootstrap.php - Nette entrypoint
    • bin - console entrypoint (bin/console)
    • db - database files
      • fixtures - PHP fixtures
      • migrations - migrations files
    • docs - documentation
    • vae
      • log - runtime and error logs
      • tmp - temp files and cache
    • tests - test engine and many cases
      • tests/cases/E2E - PhpStorm's requests files (api.http)
      • tests/cases/Integration
      • tests/cases/Unit
    • vendor - composer's folder
    • www - public content
  • ❗️ Tracy
    • Cool error 500 page

# Composer packages

Take a detailed look 👀 at each single package.

Apitte

Nettrine

Nette

Symfony

# Demo

# Development

See how to contribute (opens new window) to this package.

This package is currently maintaining by these authors.


Consider to support (opens new window) contributte development team. Also thank you for using this project.