File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed
appengine/standard/slim-framework Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change
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/
Original file line number Diff line number Diff line change 1
1
{
2
2
"require" : {
3
- "slim/slim" : " ^4.0"
3
+ "slim/slim" : " ^4.0" ,
4
+ "slim/psr7" : " ^1.3"
4
5
}
5
6
}
Original file line number Diff line number Diff line change 22
22
*/
23
23
require 'vendor/autoload.php ' ;
24
24
25
+ use Psr \Http \Message \ResponseInterface as Response ;
26
+ use Psr \Http \Message \ServerRequestInterface as Request ;
27
+ use Slim \Factory \AppFactory ;
28
+
25
29
# [START gae_slim_front_controller]
26
- $ app = new Slim \App ();
27
- $ app ->get ('/ ' , function ($ request , $ response ) {
30
+ $ app = AppFactory::create ();
31
+ $ app ->addRoutingMiddleware ();
32
+
33
+ $ app ->get ('/ ' , function (Request $ request , Response $ response ) {
28
34
// Use the Null Coalesce Operator in PHP7
29
35
// http://php.net/manual/en/language.operators.comparison.php#language.operators.comparison.coalesce
30
36
$ name = $ request ->getQueryParams ()['name ' ] ?? 'World ' ;
31
- return $ response ->getBody ()->write ("Hello, $ name! " );
37
+ $ response ->getBody ()->write ("Hello, $ name! " );
38
+ return $ response ;
32
39
});
33
40
$ app ->run ();
34
41
# [END gae_slim_front_controller]
You can’t perform that action at this time.
0 commit comments