Skip to content

Commit 6b99550

Browse files
authored
adds slim framework example (GoogleCloudPlatform#659)
1 parent 62f8414 commit 6b99550

File tree

8 files changed

+2611
-0
lines changed

8 files changed

+2611
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file specifies files that are *not* uploaded to Google Cloud Platform
2+
# using gcloud. It follows the same syntax as .gitignore, with the addition of
3+
# "#!include" directives (which insert the entries of the given .gitignore-style
4+
# file at that point).
5+
#
6+
# For more information, run:
7+
# $ gcloud topic gcloudignore
8+
#
9+
.gcloudignore
10+
# If you would like to upload your .git directory, .gitignore file or files
11+
# from your .gitignore file, remove the corresponding line
12+
# below:
13+
.git
14+
.gitignore
15+
16+
# PHP Composer dependencies:
17+
vendor/
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Slim Example for App Engine for PHP 7.2
2+
3+
This sample demonstrates how to deploy a *very* basic [Slim][slim] application to
4+
[Google App Engine for PHP 7.2][appengine-php].
5+
6+
## Setup
7+
8+
Before running this sample:
9+
10+
### Create a project (if you haven't already)
11+
12+
- Go to [Google Developers Console][console] and create a new project.
13+
14+
## Deploy to App Engine
15+
16+
**Deploy with gcloud**
17+
18+
```
19+
gcloud config set project YOUR_PROJECT_ID
20+
gcloud app deploy
21+
gcloud app browse
22+
```
23+
24+
The last command will open `https://{YOUR_PROJECT_ID}.appspot.com/`
25+
in your browser.
26+
27+
## Application Components
28+
29+
The application consists of three components:
30+
31+
1. An [`app.yaml`](app.yaml) which sets your application runtime to be `php72`.
32+
2. A [`composer.json`](composer.json) which declares your application's dependencies.
33+
3. An [`index.php`](index.php) which handles all the requests which get routed to your app.
34+
35+
The `index.php` file is the most important. All applications running on App Engine
36+
for PHP 7.2 require use of a [front controller][front-controller] file.
37+
38+
[console]: https://console.developers.google.com/project
39+
[slim]: https://www.slimframework.com/
40+
[appengine-php]: https://cloud.google.com/appengine/docs/standard/php/
41+
[front-controller]: https://stackoverflow.com/questions/6890200/what-is-a-front-controller-and-how-is-it-implemented-in-php
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
runtime: php72
2+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"require": {
3+
"slim/slim": " ^3.0"
4+
},
5+
"require-dev": {
6+
"google/cloud-tools": "^0.8.1",
7+
"phpunit/phpunit": "^5"
8+
}
9+
}

0 commit comments

Comments
 (0)