From 9d6cd641a05dad01237fd4943294437d66acb860 Mon Sep 17 00:00:00 2001 From: Daniel de Wit Date: Mon, 27 Mar 2023 09:38:01 +0200 Subject: [PATCH 1/4] Update README.md badges --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 323de0e..75fa843 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # Lighthouse Sanctum -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) -[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/daniel-de-wit/lighthouse-sanctum/run-tests?label=tests)](https://github.com/daniel-de-wit/lighthouse-sanctum/actions?query=workflow%3Arun-tests+branch%3Amaster) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md) +[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/daniel-de-wit/lighthouse-sanctum/.github/workflows/run-tests.yml?branch=master)](https://github.com/daniel-de-wit/lighthouse-sanctum/actions/workflows/run-tests.yml?query=workflow%3Arun-tests+branch%3Amaster) [![Coverage Status](https://coveralls.io/repos/github/daniel-de-wit/lighthouse-sanctum/badge.svg?branch=master)](https://coveralls.io/github/daniel-de-wit/lighthouse-sanctum?branch=master) [![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan) -[![Latest Version on Packagist](https://img.shields.io/packagist/v/daniel-de-wit/lighthouse-sanctum.svg?style=flat-square)](https://packagist.org/packages/daniel-de-wit/lighthouse-sanctum) -[![Total Downloads](https://img.shields.io/packagist/dt/daniel-de-wit/lighthouse-sanctum.svg?style=flat-square)](https://packagist.org/packages/daniel-de-wit/lighthouse-sanctum) +[![Latest Version on Packagist](https://img.shields.io/packagist/v/daniel-de-wit/lighthouse-sanctum.svg)](https://packagist.org/packages/daniel-de-wit/lighthouse-sanctum) +[![Total Downloads](https://img.shields.io/packagist/dt/daniel-de-wit/lighthouse-sanctum.svg)](https://packagist.org/packages/daniel-de-wit/lighthouse-sanctum) Add [Laravel Sanctum](https://github.com/laravel/sanctum) support to [Lighthouse](https://github.com/nuwave/lighthouse) From 07ec49f3136c9af9a59bd84bd50e428588010f3c Mon Sep 17 00:00:00 2001 From: Daniel de Wit Date: Mon, 27 Mar 2023 09:38:16 +0200 Subject: [PATCH 2/4] Update README.md requirements --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 75fa843..e374f6b 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Add [Laravel Sanctum](https://github.com/laravel/sanctum) support to [Lighthouse ## Requirements -- [laravel/laravel:^9.0](https://github.com/laravel/laravel) +- [laravel/laravel:^9.0 || ^10.0](https://github.com/laravel/laravel) - [laravel/sanctum:^2.0 || ^3.0](https://github.com/laravel/sanctum) - [nuwave/lighthouse:^5.55.1](https://github.com/nuwave/lighthouse) From 1ee6707468218d05991560aa3a7e0b2972f8da48 Mon Sep 17 00:00:00 2001 From: Daniel de Wit Date: Mon, 27 Mar 2023 09:38:41 +0200 Subject: [PATCH 3/4] Update README.md with better wording --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e374f6b..afc60cc 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ class User extends Authenticatable implements HasApiTokensContract This package relies on [API Token Authentication](https://laravel.com/docs/8.x/sanctum#api-token-authentication), which uses stateless Bearer tokens to authenticate requests. By default, [Laravel Sanctum](https://laravel.com/docs/8.x/sanctum) assumes that requests made from localhost should use the stateful [Spa Authentication](https://laravel.com/docs/8.x/sanctum#spa-authentication) instead. -To disable this behaviour, remove any lines in your sanctum configuration: +To disable this behaviour, remove any lines within the stateful section of your sanctum configuration: ```php // File: ./config/sanctum.php From 4af7fbdcd9b7075f74c0cf5374592cfe3ab0375b Mon Sep 17 00:00:00 2001 From: Daniel de Wit Date: Mon, 27 Mar 2023 09:39:23 +0200 Subject: [PATCH 4/4] Add Docker & instructions --- .gitattributes | 3 +++ Makefile | 12 ++++++++++++ README.md | 26 ++++++++++++++++++++++++++ docker-compose.yml | 7 +++++++ docker/Dockerfile | 14 ++++++++++++++ docker/conf.d/memory-limit.ini | 1 + 6 files changed, 63 insertions(+) create mode 100644 Makefile create mode 100644 docker-compose.yml create mode 100644 docker/Dockerfile create mode 100644 docker/conf.d/memory-limit.ini diff --git a/.gitattributes b/.gitattributes index 90efd6f..e77d49a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,6 +3,7 @@ # Ignore all test and documentation with "export-ignore". /.github export-ignore +/docker export-ignore /stubs export-ignore /tests export-ignore /.coveralls.yml export-ignore @@ -12,5 +13,7 @@ /.php-cs-fixer.dist.php export-ignore /.php_cs.common.php export-ignore /.php_cs.tests.php export-ignore +/docker-compose.yml export-ignore +/Makefile export-ignore /phpstan.neon export-ignore /phpunit.xml.dist export-ignore diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..132a604 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +setup: + @test -s phpunit.xml || cp phpunit.xml.dist phpunit.xml + @docker-compose run --rm app composer install + +destroy: + @docker-compose down --remove-orphans --volumes + +app: + @docker-compose run --rm app sh + +test: + @docker-compose run --rm app sh -c "php ./vendor/bin/phpunit" diff --git a/README.md b/README.md index afc60cc..f74d893 100644 --- a/README.md +++ b/README.md @@ -343,6 +343,32 @@ input LoginInput { } ``` +## Docker + +Develop locally using [Docker](https://www.docker.com/) & [Docker Compose](https://docs.docker.com/compose/). + +#### Setup +This will build the Docker image and prepare the container. + +```bash +make setup +``` + - CLI: `make app` + - Destroy: `make destroy` + +#### CLI +Enter the container with shell to start developing. + +```bash +make app +``` + +#### Destroy +Shutdown and remove the container. + +```bash +make app +``` ## Testing diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6688734 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +version: '3.7' + +services: + app: + build: docker + volumes: + - .:/var/www/html:cached diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..9387d1b --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,14 @@ +FROM php:8.2-cli-alpine + +COPY --from=composer /usr/bin/composer /usr/bin/composer + +RUN apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + && pecl install \ + pcov \ + && docker-php-ext-enable \ + pcov + +COPY conf.d /usr/local/etc/php/conf.d + +WORKDIR /var/www/html diff --git a/docker/conf.d/memory-limit.ini b/docker/conf.d/memory-limit.ini new file mode 100644 index 0000000..7999e96 --- /dev/null +++ b/docker/conf.d/memory-limit.ini @@ -0,0 +1 @@ +memory_limit = -1