Skip to content

Commit

Permalink
Merge 4af7fbd into 48f0251
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-de-wit committed Mar 27, 2023
2 parents 48f0251 + 4af7fbd commit 5b3f9b2
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Expand Up @@ -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
Expand All @@ -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
12 changes: 12 additions & 0 deletions 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"
38 changes: 32 additions & 6 deletions 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)

Expand All @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,7 @@
version: '3.7'

services:
app:
build: docker
volumes:
- .:/var/www/html:cached
14 changes: 14 additions & 0 deletions 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
1 change: 1 addition & 0 deletions docker/conf.d/memory-limit.ini
@@ -0,0 +1 @@
memory_limit = -1

0 comments on commit 5b3f9b2

Please sign in to comment.