Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-alpha.17'
Browse files Browse the repository at this point in the history
  • Loading branch information
nekofar committed May 20, 2023
2 parents 76d582a + 69539f8 commit 9f13815
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
# Changelog
All notable changes to this project will be documented in this file.

## [1.0.0-alpha.17] - 2023-05-20

### Documentation

- Add missing contribution guideline
- Add basic usage sample into readme file

## [1.0.0-alpha.16] - 2023-05-20

### Documentation

- Change minimum version to php 8.1 on readme

### Miscellaneous Tasks

- Install pnpm as a peoject dev-dependency

## [1.0.0-alpha.15] - 2023-05-20

### Bug Fixes
Expand Down
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# CONTRIBUTING

Contributions are welcome, and are accepted via pull requests.
Please review these guidelines before submitting any pull requests.

## Process

1. Fork the project
1. Create a new branch
1. Code, test, commit and push
1. Open a pull request detailing your changes. Make sure to follow the [template](.github/PULL_REQUEST_TEMPLATE.md)

## Guidelines

* Please ensure the coding style running `composer lint`.
* Send a coherent commit history, making sure each individual commit in your pull request is meaningful.
* You may need to [rebase](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) to avoid merge conflicts.
* Please remember that we follow [SemVer](http://semver.org/).

## Setup

Clone your fork, then install the dev dependencies:
```bash
composer install
```
## Lint

Lint your code:
```bash
composer lint
```
## Tests

Run all tests:
```bash
composer test
```

Check types:
```bash
composer test:types
```

Unit tests:
```bash
composer test:unit
```
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,26 @@ Requires Slim Framework 4 and PHP 8.1 or newer.
## Usage

```php
use Nekofar\Slim\JSend\ResponseFactoryDecorator;

$responseFactoryDecorator = new ResponseFactoryDecorator(/* ... */);
$response = $responseFactoryDecorator->createResponse();

// Set success payload
$response = $response->withSuccessPayload($data);
echo $response->getBody()->getContents(); // The response body
```

The resulting response will have the HTTP status code 200 OK and the JSON payload in the JSend format:

```json lines
{
"status": "success",
"data": {
/* Your data here */
}
}
```
## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
Expand Down

0 comments on commit 9f13815

Please sign in to comment.