Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
208 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,41 @@ | |||
# Couchbase PHP Beer-Sample Application | |||
|
|||
This sample application demonstrates the usage of the Couchbase PHP SDK 1.1 in | |||
combination with the Couchbase Server 2.0 release. | |||
|
|||
The official tutorial belonging to this application can be found | |||
[here](http://www.couchbase.com/docs/couchbase-sdk-php-1.1/tutorial.html). | |||
|
|||
It is a very simple web application that should show off the basics on how to | |||
interact with Couchbase Server 2.0 on both key-based and view-based operations. | |||
|
|||
## Requirements | |||
Please make sure to have PHP 5.3 and Composer available. You also need to have | |||
the Couchbase Extension (Version 1.1 or higher) installed. | |||
|
|||
## Installation | |||
Clone the application (or follow along in the tutorial), and run | |||
|
|||
``` | |||
php composer.phar install | |||
``` | |||
|
|||
Make sure to clone the application inside the /beersample-php subdirectory of | |||
the WEBROOT, because otherwise you need to change all the absolute links in | |||
there as well. | |||
|
|||
## Configuration | |||
The application should be able to run out of the box if you have the beer-sample | |||
dataset installed and Couchbase Server 2.0 is running on your local machine. You | |||
can tune the settings on top of the `index.php` file: | |||
|
|||
```php | |||
define("SILEX_DEBUG", true); | |||
define("COUCHBASE_HOSTS", "127.0.0.1"); | |||
define("COUCHBASE_BUCKET", "beer-sample"); | |||
define("COUCHBASE_PASSWORD", ""); | |||
define("COUCHBASE_CONN_PERSIST", true); | |||
define("INDEX_DISPLAY_LIMIT", 20); | |||
``` | |||
|
|||
Have fun! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
{% extends "layout.twig.html" %} | |||
|
|||
{% block content %} | |||
<h3>Edit Beer</h3> | |||
|
|||
<form method="post" action="/beersample-php/beers/edit/{{beer.id}}"> | |||
<fieldset> | |||
<legend>General Info</legend> | |||
<div class="span12"> | |||
<div class="span6"> | |||
<label>Name</label> | |||
<input type="text" name="beer_name" placeholder="The name of the beer." value="{{beer.name}}"> | |||
|
|||
<label>Description</label> | |||
<input type="text" name="beer_description" placeholder="A short description." value="{{beer.description}}"> | |||
</div> | |||
<div class="span6"> | |||
<label>Style</label> | |||
<input type="text" name="beer_style" placeholder="Bitter? Sweet? Hoppy?" value="{{beer.style}}"> | |||
|
|||
<label>Category</label> | |||
<input type="text" name="beer_category" placeholder="Ale? Stout? Lager?" value="{{beer.category}}"> | |||
</div> | |||
</div> | |||
</fieldset> | |||
<fieldset> | |||
<legend>Details</legend> | |||
<div class="span12"> | |||
<div class="span6"> | |||
<label>Alcohol (ABV)</label> | |||
<input type="text" name="beer_abv" placeholder="The beer's ABV" value="{{beer.abv}}"> | |||
|
|||
<label>Biterness (IBU)</label> | |||
<input type="text" name="beer_ibu" placeholder="The beer's IBU" value="{{beer.ibu}}"> | |||
</div> | |||
<div class="span6"> | |||
<label>Beer Color (SRM)</label> | |||
<input type="text" name="beer_srm" placeholder="The beer's SRM" value="{{beer.srm}}"> | |||
|
|||
<label>Universal Product Code (UPC)</label> | |||
<input type="text" name="beer_upc" placeholder="The beer's UPC" value="{{beer.upc}}"> | |||
</div> | |||
</div> | |||
</fieldset> | |||
<fieldset> | |||
<legend>Brewery</legend> | |||
<div class="span12"> | |||
<div class="span6"> | |||
<label>Brewery</label> | |||
<input type="text" name="beer_brewery_id" placeholder="The brewery" value="{{beer.brewery_id}}"> | |||
</div> | |||
</div> | |||
</fieldset> | |||
<div class="form-actions"> | |||
<button type="submit" class="btn btn-primary">Save changes</button> | |||
</div> | |||
</form> | |||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,17 @@ | |||
{% extends "layout.twig.html" %} | |||
|
|||
{% block content %} | |||
<h3>Show Details for Beer "{{beer.name}}"</h3> | |||
<table class="table table-striped"> | |||
<tbody> | |||
{% for key,attribute in beer %} | |||
<c:forEach items="${beer}" var="item"> | |||
<tr> | |||
<td><strong>{{key}}</strong></td> | |||
<td>{{attribute}}</td> | |||
</tr> | |||
</c:forEach> | |||
{% endfor %} | |||
</tbody> | |||
</table> | |||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,17 @@ | |||
{% extends "layout.twig.html" %} | |||
|
|||
{% block content %} | |||
<h3>Show Details for Brewery "{{brewery.name}}"</h3> | |||
<table class="table table-striped"> | |||
<tbody> | |||
{% for key,attribute in brewery %} | |||
<c:forEach items="${beer}" var="item"> | |||
<tr> | |||
<td><strong>{{key}}</strong></td> | |||
<td>{{attribute}}</td> | |||
</tr> | |||
</c:forEach> | |||
{% endfor %} | |||
</tbody> | |||
</table> | |||
{% endblock %} |