Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sagikazarmark committed Apr 2, 2018
1 parent 5ddd14d commit 9f60505
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,57 @@

**Work in progress! First estimated preview: end of April**

## Installation

Download the [latest](https://github.com/twirphp/protoc-gen-twirp_php/releases/latest) release from the Releases page
and put it into your `$PATH` prefix (or any location, but that requires some configuration, see later).

This is a [protoc](https://github.com/golang/protobuf), so you will have to install that as well.

Alternatively you can manually download and build the project. For that, you are going to need [dep](https://golang.github.io/dep/).

```bash
$ go get github.com/twirphp/protoc-gen-twirp_php
$ cd $GOROOT/src/github.com/twirphp/protoc-gen-twirp_php
$ dep ensure
$ go install
```


## Usage

Use it like any protoc plugin to generate both server and client code:

```bash
$ protoc -I example/ --php_out . --twirp_php . service.proto
```

If you downloaded the generator outside of your `$PATH` prefix, you need to manually pass the location to the compiler:

```bash
$ protoc -I example/ --plugin=protoc-gen-twirp_php=path/to/protoc-gen-twirp_php --php_out . --twirp_php . service.proto
```


### Server

In order to use the server you have to install some dependencies to your PHP project via [Composer](https://getcomposer.org/):

```bash
$ composer require twirp/twirp
```

You need to choose a [PSR-7](http://www.php-fig.org/psr/psr-7/) implementation along with it's [factory](https://github.com/php-http/message-factory):

```bash
$ composer require guzzlehttp/psr7 php-http/message
```

The code generator creates a service interface which you need to implement.

TODO: create and example an link it here


## License

The MIT License (MIT). Please see [License File](LICENSE) for more information.

0 comments on commit 9f60505

Please sign in to comment.