Skip to content

Commit

Permalink
feat: added a basic documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorhugoro1 committed Aug 25, 2021
1 parent 0202f71 commit 7012737
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .setup/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM php:8.0-fpm-alpine

COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

WORKDIR /var/www/html

COPY . /var/www/html

RUN composer install --optimize-autoloader --no-interaction
17 changes: 17 additions & 0 deletions .setup/site.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
server {
index index.php index.html;
server_name php-docker.local;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html;

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Basic API

A Basic API made with PHP without any Framework

## Uses

- PHP 8.0
- PHP League - Container
- PHP League - Route
- Laminas Diactoros
- PHPUnit

## How to Run

To execute this project can be made two ways.

Without `docker-compose`:

```bash
composer install
php -S localhost:8080
```

With `docker-compose`:

```bash
docker-compose up -d
```

## Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

## Credits

- [Vitor Merencio](https://github.com/vitorhugoro1)

## License

The GNU GENERAL PUBLIC LICENSE (GNU). Please see [License File](LICENSE.md) for more information.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"require": {
"php": "^8.0",
"league/container": "^4.1",
"league/route": "^5.1",
"laminas/laminas-diactoros": "^2.6",
Expand Down
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: "3.7"

services:
app:
image: nginx:latest
ports:
- 8080:80
volumes:
- ./:/var/www/html
- ./.setup/site.conf:/etc/nginx/conf.d/default.conf
links:
- php
php:
build:
context: .
dockerfile: .setup/Dockerfile
volumes:
- ./:/var/www/html

0 comments on commit 7012737

Please sign in to comment.