Skip to content

Commit

Permalink
Merge pull request drslump#23 from Arul-/patch-1
Browse files Browse the repository at this point in the history
enabled source code highlighting for PHP
  • Loading branch information
drslump committed Oct 1, 2012
2 parents b875c82 + 71ba321 commit 2948711
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,27 @@ For more information see the [included man pages](http://drslump.github.com/Prot

## Example usage

require_once 'DrSlump/Protobuf.php';
\DrSlump\Protobuf::autoload();

$person = new Tutorial\Person();
$person->name = 'DrSlump';
$person->setId(12);

$book = new Tutorial\AddressBook();
$book->addPerson($person);

// Use default codec
$data = $book->serialize();

// Use custom codec
$codec = new \DrSlump\Protobuf\Codec\Binary();
$data = $codec->encode($book);
// ... or ...
$data = $book->serialize($codec);

```php
<?php
require_once 'DrSlump/Protobuf.php';
\DrSlump\Protobuf::autoload();

$person = new Tutorial\Person();
$person->name = 'DrSlump';
$person->setId(12);

$book = new Tutorial\AddressBook();
$book->addPerson($person);

// Use default codec
$data = $book->serialize();

// Use custom codec
$codec = new \DrSlump\Protobuf\Codec\Binary();
$data = $codec->encode($book);
// ... or ...
$data = $book->serialize($codec);
```

## Installation

Expand Down

0 comments on commit 2948711

Please sign in to comment.