Skip to content

Commit

Permalink
Merge pull request #3 from star-inc/dev
Browse files Browse the repository at this point in the history
Abigail (Version 2.0)
  • Loading branch information
supersonictw authored Jul 17, 2021
2 parents 5fb617a + 74d368d commit 20f66c3
Show file tree
Hide file tree
Showing 21 changed files with 676 additions and 584 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Integration

on: [ push ]

jobs:
build-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: PHP Composer
uses: php-actions/composer@v5

- name: PHPUnit tests
uses: php-actions/phpunit@v3
with:
php_version: 7.4
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
vendor/
.idea/
composer.lock
*.cache
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Copyright (c) 2021 Star Inc. (https://starinc.xyz)
Copyright (c) MArc J. Schmidt

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
php-rest-service
Abigail
==============
[![Integration](https://github.com/star-inc/Abigail/actions/workflows/integration.yml/badge.svg)](https://github.com/star-inc/Abigail/actions/workflows/integration.yml)

Php-Rest-Service is a simple and fast PHP class for RESTful JSON APIs.

[![Build Status](https://travis-ci.org/marcj/php-rest-service.png)](https://travis-ci.org/marcj/php-rest-service)
Abigail is the fork from `marcj/php-rest-service`, which is a simple and fast PHP class for server side RESTful APIs.

Features
--------
Expand All @@ -12,7 +11,8 @@ Features
+ Regular Expression support
+ Error handling through PHP Exceptions
+ Parameter validation through PHP function signature
+ Can return a summary of all routes or one route through `OPTIONS` method based on PHPDoc (if `OPTIONS` is not overridden)
+ Can return a summary of all routes or one route through `OPTIONS` method based on PHPDoc (if `OPTIONS` is not
overridden)
+ Support of `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD` and `OPTIONS`
+ Suppress the HTTP status code with ?_suppress_status_code=1 (for clients that have troubles with that)
+ Supports ?_method=`httpMethod` as addition to the actual HTTP method.
Expand All @@ -21,8 +21,8 @@ Features
Installation
------------

- https://packagist.org/packages/marcj/php-rest-service.
- More information available under https://packagist.org/.
- https://packagist.org/packages/marcj/php-rest-service.
- More information available under https://packagist.org/.

Create a `composer.json`:

Expand All @@ -42,29 +42,33 @@ $ php composer.phar install
```

After the installation, you need to include the `vendor/autoload.php` to make the class in your script available.

```php
include 'vendor/autoload.php';
```

Requirements
============

- PHP 5.3 and above.
- PHPUnit to execute the test suite.
- Setup PATH_INFO in mod_rewrite (.htaccess) or other webserver configuration
- PHP 7.4 and above.
- PHPUnit to execute the test suite.
- Setup PATH_INFO in mod_rewrite (.htaccess) or other webserver configuration

Example config:
apache webserver
----------------

```
#.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.+) index.php/$1 [L,QSA]
```

nginx webserver
---------------

```
// edit virtualhost /etc/nginx/conf.d/name_virtualhost_file
server {
Expand All @@ -86,7 +90,6 @@ Usage Demo

### Way 1. The dirty & fast


```php

use RestService\Server;
Expand Down Expand Up @@ -161,14 +164,14 @@ class Admin {
```

Generates following entry points:

```
+ GET /admin/logged-in
+ POST /admin/login?username=&password=
+ GET /admin/stats/([0-9]+)
+ GET /admin/stats
```


### Way 3. Custom rules with controller

`index.php`:
Expand Down Expand Up @@ -246,11 +249,10 @@ class Tools {
}
```


## Responses

The response body is always a array (JSON per default) containing a status code and the actual data.
If a exception has been thrown, it contains the status 500, the exception class name as error and the message as message.
The response body is always a array (JSON per default) containing a status code and the actual data. If a exception has
been thrown, it contains the status 500, the exception class name as error and the message as message.

Some examples:

Expand Down Expand Up @@ -304,6 +306,3 @@ License
Licensed under the MIT License. See the LICENSE file for more details.

Take a look into the code, to get more information about the possibilities. It's well documented.


[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/marcj/php-rest-service/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
23 changes: 0 additions & 23 deletions Test/Basic/BasicTest.php

This file was deleted.

82 changes: 0 additions & 82 deletions Test/Synthetic/CollectTest.php

This file was deleted.

123 changes: 0 additions & 123 deletions Test/Synthetic/CustomRoutesTest.php

This file was deleted.

Loading

0 comments on commit 20f66c3

Please sign in to comment.