diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f574b66c14..907e2b3a85 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: '8.2' - name: Run Script run: testing/run_cs_check.sh @@ -25,7 +25,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: '8.2' - name: Get changed files id: changedFiles uses: tj-actions/changed-files@v44 diff --git a/.kokoro/deploy_gae.cfg b/.kokoro/deploy_gae.cfg index 3b7a2d7645..e168779678 100644 --- a/.kokoro/deploy_gae.cfg +++ b/.kokoro/deploy_gae.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/php80" + value: "gcr.io/cloud-devrel-kokoro-resources/php81" } # Run the deployment tests diff --git a/.kokoro/deploy_gcf.cfg b/.kokoro/deploy_gcf.cfg index 243fbc7b69..40fa84403d 100644 --- a/.kokoro/deploy_gcf.cfg +++ b/.kokoro/deploy_gcf.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/php80" + value: "gcr.io/cloud-devrel-kokoro-resources/php81" } # Run the deployment tests diff --git a/.kokoro/deploy_misc.cfg b/.kokoro/deploy_misc.cfg index 8efc1b10f8..12d103d622 100644 --- a/.kokoro/deploy_misc.cfg +++ b/.kokoro/deploy_misc.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/php80" + value: "gcr.io/cloud-devrel-kokoro-resources/php81" } # Run the deployment tests diff --git a/.kokoro/php80.cfg b/.kokoro/php83.cfg similarity index 87% rename from .kokoro/php80.cfg rename to .kokoro/php83.cfg index f5837873dc..4e05f8133a 100644 --- a/.kokoro/php80.cfg +++ b/.kokoro/php83.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/php80" + value: "gcr.io/cloud-devrel-kokoro-resources/php83" } # Give the docker image a unique project ID and credentials per PHP version diff --git a/.kokoro/php_rest.cfg b/.kokoro/php_rest.cfg index 650b018bfa..1e7cfc90d6 100644 --- a/.kokoro/php_rest.cfg +++ b/.kokoro/php_rest.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/php80" + value: "gcr.io/cloud-devrel-kokoro-resources/php81" } # Set this project to run REST tests only diff --git a/appengine/standard/getting-started/README.md b/appengine/standard/getting-started/README.md index 869457cb36..f475efdf01 100644 --- a/appengine/standard/getting-started/README.md +++ b/appengine/standard/getting-started/README.md @@ -1,7 +1,7 @@ -# Getting Started on App Engine for PHP 7.4 +# Getting Started on App Engine for PHP 8.1 This sample demonstrates how to deploy a PHP application which integrates with -Cloud SQL and Cloud Storage on App Engine Standard for PHP 7.4. The tutorial +Cloud SQL and Cloud Storage on App Engine Standard for PHP 8.1. The tutorial uses the Slim framework. -## View the [full tutorial](https://cloud.google.com/appengine/docs/standard/php7/building-app/) +## View the [full tutorial](https://cloud.google.com/appengine/docs/standard/php-gen2/building-app) diff --git a/appengine/standard/slim-framework/README.md b/appengine/standard/slim-framework/README.md index 42fb888378..c7e9c95a13 100644 --- a/appengine/standard/slim-framework/README.md +++ b/appengine/standard/slim-framework/README.md @@ -1,7 +1,7 @@ -# Slim Framework on App Engine for PHP 7.4 +# Slim Framework on App Engine for PHP This sample demonstrates how to deploy a *very* basic [Slim][slim] application to -[Google App Engine for PHP 7.4][appengine-php]. For a more complete guide, follow +[Google App Engine for PHP][appengine-php]. For a more complete guide, follow the [Building an App][building-an-app] tutorial. ## Setup @@ -34,7 +34,7 @@ The application consists of three components: 3. An [`index.php`](index.php) which handles all the requests which get routed to your app. The `index.php` file is the most important. All applications running on App Engine -for PHP 7.4 require use of a [front controller][front-controller] file. +for PHP require use of a [front controller][front-controller] file. [console]: https://console.developers.google.com/project [slim]: https://www.slimframework.com/ diff --git a/appengine/standard/slim-framework/phpunit.xml.dist b/appengine/standard/slim-framework/phpunit.xml.dist index afa62ef701..b15d7cb383 100644 --- a/appengine/standard/slim-framework/phpunit.xml.dist +++ b/appengine/standard/slim-framework/phpunit.xml.dist @@ -16,7 +16,7 @@ --> - + test diff --git a/bigtable/src/update_app_profile.php b/bigtable/src/update_app_profile.php index b6dd451609..305ee8c85a 100644 --- a/bigtable/src/update_app_profile.php +++ b/bigtable/src/update_app_profile.php @@ -90,7 +90,7 @@ function update_app_profile( if ($operationResponse->operationSucceeded()) { $updatedAppProfile = $operationResponse->getResult(); printf('App profile updated: %s' . PHP_EOL, $updatedAppProfile->getName()); - // doSomethingWith($updatedAppProfile) + // doSomethingWith($updatedAppProfile) } else { $error = $operationResponse->getError(); // handleError($error) diff --git a/bigtable/src/update_cluster.php b/bigtable/src/update_cluster.php index e2a9aa0a47..feaaa640ae 100644 --- a/bigtable/src/update_cluster.php +++ b/bigtable/src/update_cluster.php @@ -55,7 +55,7 @@ function update_cluster( if ($operationResponse->operationSucceeded()) { $updatedCluster = $operationResponse->getResult(); printf('Cluster updated with the new num of nodes: %s.' . PHP_EOL, $updatedCluster->getServeNodes()); - // doSomethingWith($updatedCluster) + // doSomethingWith($updatedCluster) } else { $error = $operationResponse->getError(); // handleError($error) diff --git a/bigtable/src/update_instance.php b/bigtable/src/update_instance.php index 3a00c973bf..36c22d3c47 100644 --- a/bigtable/src/update_instance.php +++ b/bigtable/src/update_instance.php @@ -73,7 +73,7 @@ function update_instance( if ($operationResponse->operationSucceeded()) { $updatedInstance = $operationResponse->getResult(); printf('Instance updated with the new display name: %s.' . PHP_EOL, $updatedInstance->getDisplayName()); - // doSomethingWith($updatedInstance) + // doSomethingWith($updatedInstance) } else { $error = $operationResponse->getError(); // handleError($error) diff --git a/datastore/api/test/ConceptsTest.php b/datastore/api/test/ConceptsTest.php index a2177b4aaa..60cf05f2ac 100644 --- a/datastore/api/test/ConceptsTest.php +++ b/datastore/api/test/ConceptsTest.php @@ -441,10 +441,10 @@ public function testKeyFilter() $this->assertStringContainsString('Query\Query Object', $output); $this->runEventuallyConsistentTest( - function () use ($key1, $output) { - $this->assertStringContainsString('Found 1 records', $output); - $this->assertStringContainsString($key1->path()[0]['name'], $output); - }); + function () use ($key1, $output) { + $this->assertStringContainsString('Found 1 records', $output); + $this->assertStringContainsString($key1->path()[0]['name'], $output); + }); } public function testAscendingSort() diff --git a/dlp/README.md b/dlp/README.md index b5c09d3157..fa13f5d8d8 100644 --- a/dlp/README.md +++ b/dlp/README.md @@ -54,7 +54,7 @@ See the [DLP Documentation](https://cloud.google.com/dlp/docs/inspecting-text) f export GOOGLE_PROJECT_ID=YOUR_PROJECT_ID ``` - [Create a Google Cloud Storage bucket](https://console.cloud.google.com/storage) and upload [test.txt](src/test/data/test.txt). - - Set the `GOOGLE_STORAGE_BUCKET` environment variable. + - Set the `GOOGLE_STORAGE_BUCKET` environment variable. - Set the `GCS_PATH` environment variable to point to the path for the bucket file. ``` export GOOGLE_STORAGE_BUCKET=YOUR_BUCKET @@ -120,7 +120,7 @@ PHP Fatal error: Uncaught Error: Call to undefined function Google\Protobuf\Int You may need to install the bcmath PHP extension. e.g. (may depend on your php version) ``` -$ sudo apt-get install php8.0-bcmath +$ sudo apt-get install php8.1-bcmath ``` diff --git a/eventarc/generic/Dockerfile b/eventarc/generic/Dockerfile index de17cec683..097535fc84 100644 --- a/eventarc/generic/Dockerfile +++ b/eventarc/generic/Dockerfile @@ -5,7 +5,7 @@ # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ # Use the official PHP image. # https://hub.docker.com/_/php -FROM php:8.0-apache +FROM php:8.1-apache # Configure PHP for Cloud Run. # Precompile PHP code with opcache. diff --git a/functions/helloworld_http/composer.json b/functions/helloworld_http/composer.json index 2c3aa044ac..e627ccb769 100644 --- a/functions/helloworld_http/composer.json +++ b/functions/helloworld_http/composer.json @@ -1,6 +1,6 @@ { "require": { - "php": ">= 7.4", + "php": ">= 8.1", "google/cloud-functions-framework": "^1.1" }, "scripts": { diff --git a/functions/helloworld_pubsub/composer.json b/functions/helloworld_pubsub/composer.json index c3eadb86ba..ed28a79488 100644 --- a/functions/helloworld_pubsub/composer.json +++ b/functions/helloworld_pubsub/composer.json @@ -1,6 +1,6 @@ { "require": { - "php": ">= 7.4", + "php": ">= 8.1", "cloudevents/sdk-php": "^1.0", "google/cloud-functions-framework": "^1.1" }, diff --git a/functions/helloworld_storage/SampleIntegrationTest.php b/functions/helloworld_storage/SampleIntegrationTest.php index d7ead4402e..0216aed595 100644 --- a/functions/helloworld_storage/SampleIntegrationTest.php +++ b/functions/helloworld_storage/SampleIntegrationTest.php @@ -108,7 +108,7 @@ public static function startFunctionFramework(): void $uri = 'localhost:' . $port; // https://symfony.com/doc/current/components/process.html#usage - self::$process = new Process([$php, '-S', $uri, 'vendor/bin/router.php'], null, [ + self::$process = new Process([$php, '-S', $uri, 'vendor/google/cloud-functions-framework/router.php'], null, [ 'FUNCTION_SIGNATURE_TYPE' => 'cloudevent', 'FUNCTION_TARGET' => 'helloGCS', ]); diff --git a/functions/helloworld_storage/composer.json b/functions/helloworld_storage/composer.json index cf57118539..1e869f6f7b 100644 --- a/functions/helloworld_storage/composer.json +++ b/functions/helloworld_storage/composer.json @@ -1,6 +1,6 @@ { "require": { - "php": ">= 7.4", + "php": ">= 8.1", "google/cloud-functions-framework": "^1.1" }, "scripts": { diff --git a/functions/http_content_type/index.php b/functions/http_content_type/index.php index 6ea1c76c14..fc307df3e0 100644 --- a/functions/http_content_type/index.php +++ b/functions/http_content_type/index.php @@ -26,30 +26,30 @@ function helloContent(ServerRequestInterface $request): string switch ($request->getHeaderLine('content-type')) { // '{"name":"John"}' case 'application/json': - if (!empty($body)) { - $json = json_decode($body, true); - if (json_last_error() != JSON_ERROR_NONE) { - throw new RuntimeException(sprintf( - 'Could not parse body: %s', - json_last_error_msg() - )); - } - $name = $json['name'] ?? $name; - } - break; - // 'John', stored in a stream + if (!empty($body)) { + $json = json_decode($body, true); + if (json_last_error() != JSON_ERROR_NONE) { + throw new RuntimeException(sprintf( + 'Could not parse body: %s', + json_last_error_msg() + )); + } + $name = $json['name'] ?? $name; + } + break; + // 'John', stored in a stream case 'application/octet-stream': - $name = $body; - break; - // 'John' + $name = $body; + break; + // 'John' case 'text/plain': - $name = $body; - break; - // 'name=John' in the body of a POST request (not the URL) + $name = $body; + break; + // 'name=John' in the body of a POST request (not the URL) case 'application/x-www-form-urlencoded': - parse_str($body, $data); - $name = $data['name'] ?? $name; - break; + parse_str($body, $data); + $name = $data['name'] ?? $name; + break; } return sprintf('Hello %s!', htmlspecialchars($name)); diff --git a/functions/response_streaming/index.php b/functions/response_streaming/index.php index b1ce5b8c99..c57051529d 100644 --- a/functions/response_streaming/index.php +++ b/functions/response_streaming/index.php @@ -27,7 +27,7 @@ function streamBigQuery(ServerRequestInterface $request) $bigQuery = new BigQueryClient(['projectId' => $projectId]); $queryJobConfig = $bigQuery->query( 'SELECT abstract FROM `bigquery-public-data.breathe.bioasq` LIMIT 1000' - ); + ); $queryResults = $bigQuery->runQuery($queryJobConfig); // Stream out large payload by iterating rows and flushing output. diff --git a/functions/typed_greeting/composer.json b/functions/typed_greeting/composer.json index 6655c8e40e..67aa01e363 100644 --- a/functions/typed_greeting/composer.json +++ b/functions/typed_greeting/composer.json @@ -1,6 +1,6 @@ { "require": { - "php": ">= 7.4", + "php": ">= 8.1", "google/cloud-functions-framework": "^1.3" }, "scripts": { diff --git a/run/helloworld/Dockerfile b/run/helloworld/Dockerfile index 8f4c82cbb1..f5be737703 100644 --- a/run/helloworld/Dockerfile +++ b/run/helloworld/Dockerfile @@ -17,7 +17,7 @@ # Use the official PHP image. # https://hub.docker.com/_/php -FROM php:8.0-apache +FROM php:8.1-apache # Configure PHP for Cloud Run. # Precompile PHP code with opcache. diff --git a/run/laravel/README.md b/run/laravel/README.md index a3f33122fe..04f18d8e22 100644 --- a/run/laravel/README.md +++ b/run/laravel/README.md @@ -2,7 +2,7 @@ This sample shows you how to deploy Laravel on Cloud Run, connecting to a Cloud SQL database, and using Secret Manager for credential management. -The deployed example will be a simple CRUD application listing products, and a customised Laravel welcome page showing the deployment information. +The deployed example will be a simple CRUD application listing products, and a customised Laravel welcome page showing the deployment information. ![Laravel Demo Screenshot](laravel-demo-screenshot.png) @@ -16,7 +16,7 @@ In this tutorial, you will: * Deploy a Laravel app to Cloud Run. * Host static files on Cloud Storage. * Use Cloud Build to automate deployment. -* Use Cloud Run Jobs to apply database migrations. +* Use Cloud Run Jobs to apply database migrations. ## Costs @@ -52,7 +52,7 @@ This tutorial uses the following billable components of Google Cloud: ## Prepare your environment -* Clone a copy of the code into your local machine; +* Clone a copy of the code into your local machine; ```bash git clone https://github.com/GoogleCloudPlatform/php-docs-samples.git @@ -63,19 +63,19 @@ This tutorial uses the following billable components of Google Cloud: You will need PHP on your local system in order to run `php artisan` commands later. -* Check you have PHP 8.0.2 or higher installed (or [install it](https://www.php.net/manual/en/install.php)): +* Check you have PHP 8.1 or higher installed (or [install it](https://www.php.net/manual/en/install.php)): ```bash php --version ``` -* Check you have `composer` installed (or [install it](https://getcomposer.org/download/)): +* Check you have `composer` installed (or [install it](https://getcomposer.org/download/)): ```bash composer --version ``` -* Install the PHP dependencies: +* Install the PHP dependencies: ```bash composer install @@ -83,7 +83,7 @@ You will need PHP on your local system in order to run `php artisan` commands la ## Confirm your Node setup -You will need Node on your local system in order to generate static assets later. +You will need Node on your local system in order to generate static assets later. * Check you have node and npm installed (or [install them](https://cloud.google.com/nodejs/docs/setup)): @@ -93,7 +93,7 @@ You will need Node on your local system in order to generate static assets later ``` -* Install the Node dependencies: +* Install the Node dependencies: ```bash npm install @@ -102,7 +102,7 @@ You will need Node on your local system in order to generate static assets later ## Preparing backing services -There are many variables in this tutorial. Set these early to help with copying code snippets: +There are many variables in this tutorial. Set these early to help with copying code snippets: ``` export PROJECT_ID=$(gcloud config get-value project) @@ -111,13 +111,13 @@ export REGION=us-central1 export INSTANCE_NAME=myinstance export DATABASE_NAME=mydatabase export DATABASE_USERNAME=myuser -export DATABASE_PASSWORD=$(cat /dev/urandom | LC_ALL=C tr -dc '[:alpha:]'| fold -w 30 | head -n1) +export DATABASE_PASSWORD=$(cat /dev/urandom | LC_ALL=C tr -dc '[:alpha:]'| fold -w 30 | head -n1) export ASSET_BUCKET=${PROJECT_ID}-static ``` ### Cloud SQL -* Create a MySQL instance: +* Create a MySQL instance: ```bash gcloud sql instances create ${INSTANCE_NAME} \ @@ -129,14 +129,14 @@ export ASSET_BUCKET=${PROJECT_ID}-static Note: if this operation takes longer than 10 minutes to complete, run the suggested `gcloud beta sql operations wait` command to track ongoing progress. -* Create a database in that MySQL instance: +* Create a database in that MySQL instance: ```bash gcloud sql databases create ${DATABASE_NAME} \ --instance ${INSTANCE_NAME} ``` -* Create a user for the database: +* Create a user for the database: ```bash gcloud sql users create ${DATABASE_USERNAME} \ @@ -147,7 +147,7 @@ export ASSET_BUCKET=${PROJECT_ID}-static ### Setup Cloud Storage -* Create a Cloud Storage bucket: +* Create a Cloud Storage bucket: ```bash gsutil mb gs://${ASSET_BUCKET} @@ -155,7 +155,7 @@ export ASSET_BUCKET=${PROJECT_ID}-static ### Setup Artifact Registry -* Create an Artifact Registry: +* Create an Artifact Registry: ```bash gcloud artifacts repositories create containers \ @@ -163,7 +163,7 @@ export ASSET_BUCKET=${PROJECT_ID}-static --location=${REGION} ``` -* Determine the registry name for future operations: +* Determine the registry name for future operations: ```bash export REGISTRY_NAME=${REGION}-docker.pkg.dev/${PROJECT_ID}/containers @@ -177,8 +177,8 @@ export ASSET_BUCKET=${PROJECT_ID}-static cp .env.example .env ``` -* Update the values in `.env` with your values. - +* Update the values in `.env` with your values. + ⚠️ Replace `${}` with your values, don't use the literals. Get these values with e.g. `echo ${DATABASE_NAME}` * DB_CONNECTION: `mysql` @@ -190,7 +190,7 @@ export ASSET_BUCKET=${PROJECT_ID}-static Note: `ASSET_URL` is generated from `ASSET_BUCKET` and doesn't need to be hardcoded. -* Update the `APP_KEY` by generating a new key: +* Update the `APP_KEY` by generating a new key: ```bash php artisan key:generate ``` @@ -199,7 +199,7 @@ export ASSET_BUCKET=${PROJECT_ID}-static ### Store secret values in Secret Manager -* Create a secret with the value of your `.env` file: +* Create a secret with the value of your `.env` file: ```bash gcloud secrets create laravel_settings --data-file .env @@ -207,7 +207,7 @@ export ASSET_BUCKET=${PROJECT_ID}-static ### Configure access to the secret -* Allow Cloud Run access to the secret: +* Allow Cloud Run access to the secret: ```bash gcloud secrets add-iam-policy-binding laravel_settings \ @@ -219,7 +219,7 @@ export ASSET_BUCKET=${PROJECT_ID}-static ### Build the app into a container -* Using Cloud Build and Google Cloud Buildpacks, create the container image: +* Using Cloud Build and Google Cloud Buildpacks, create the container image: ```bash gcloud builds submit \ @@ -228,9 +228,9 @@ export ASSET_BUCKET=${PROJECT_ID}-static ### Applying database migrations -With Cloud Run Jobs, you can use the same container from your service to perform administration tasks, such as database migrations. +With Cloud Run Jobs, you can use the same container from your service to perform administration tasks, such as database migrations. -The configuration is similar to the deployment to Cloud Run, requiring the database and secret values. +The configuration is similar to the deployment to Cloud Run, requiring the database and secret values. 1. Create a Cloud Run job to apply database migrations: @@ -250,22 +250,22 @@ The configuration is similar to the deployment to Cloud Run, requiring the datab gcloud run jobs execute migrate --region ${REGION} --wait ``` -* Confirm the application of database migrations by clicking the "See logs for this execution" link. +* Confirm the application of database migrations by clicking the "See logs for this execution" link. - * You should see "INFO Running migrations." with multiple items labelled "DONE". + * You should see "INFO Running migrations." with multiple items labelled "DONE". * You should also see "Container called exit(0).", where `0` is the exit code for success. ### Upload static assets -Using the custom `npm` command, you can use `vite` to compile and `gsutil` to copy the assets from your application to Cloud Storage. +Using the custom `npm` command, you can use `vite` to compile and `gsutil` to copy the assets from your application to Cloud Storage. -* Upload static assets: +* Upload static assets: ```bash npm run update-static ``` - This command uses the `update-static` script in `package.json`. + This command uses the `update-static` script in `package.json`. * Confirm the output of this operation @@ -273,7 +273,7 @@ Using the custom `npm` command, you can use `vite` to compile and `gsutil` to co ### Deploy the service to Cloud Run -1. Deploy the service from the previously created image, specifying the database connection and secret configuration: +1. Deploy the service from the previously created image, specifying the database connection and secret configuration: ```bash gcloud run deploy laravel \ @@ -288,20 +288,20 @@ Using the custom `npm` command, you can use `vite` to compile and `gsutil` to co 1. Go to the Service URL to view the website. -1. Confirm the information in the lower right of the Laravel welcome screen. +1. Confirm the information in the lower right of the Laravel welcome screen. * You should see a variation of "Laravel v9... (PHP v8...)" (the exact version of Laravel and PHP may change) * You should see the a variation of "Service: laravel. Revision laravel-00001-vid." (the revision name ends in three random characters, which will differ for every deployment) - * You should see "Project: (your project). Region (your region)." + * You should see "Project: (your project). Region (your region)." -1. Click on the "demo products" link, and create some entries. +1. Click on the "demo products" link, and create some entries. - * You should be able to see a styled page, confirming static assets are being served. -You should be able to write entries to the database, and read them back again, confirming database connectivity. + * You should be able to see a styled page, confirming static assets are being served. +You should be able to write entries to the database, and read them back again, confirming database connectivity. ## Updating the application -While the initial provisioning and deployment steps were complex, making updates is a simpler process. +While the initial provisioning and deployment steps were complex, making updates is a simpler process. To make changes: build the container (to capture any new application changes), then update the service to use this new container image: @@ -318,7 +318,7 @@ To apply application code changes, update the Cloud Run service with this new co --region ${REGION} ``` - Note: you do not have to re-assert the database or secret settings on future deployments, unless you want to change these values. + Note: you do not have to re-assert the database or secret settings on future deployments, unless you want to change these values. To apply database migrations, run the Cloud Run job using the newly built container: @@ -328,7 +328,7 @@ To apply database migrations, run the Cloud Run job using the newly built contai Note: To generate new migrations to apply, you will need to run `php artisan make:migration` in a local development environment. -To update static assets, run the custom npm command from earlier: +To update static assets, run the custom npm command from earlier: ```bash npm run update-static @@ -339,15 +339,15 @@ To update static assets, run the custom npm command from earlier: ### Database migrations -This tutorial opts to use Cloud Run Jobs to process database applications in an environment where connections to Cloud SQL can be done in a safe and secure manner. +This tutorial opts to use Cloud Run Jobs to process database applications in an environment where connections to Cloud SQL can be done in a safe and secure manner. -This operation could be done on the user's local machine, which would require the installation and use of [Cloud SQL Auth Proxy](https://cloud.google.com/sql/docs/mysql/sql-proxy). Using Cloud Run Jobs removes that complexity. +This operation could be done on the user's local machine, which would require the installation and use of [Cloud SQL Auth Proxy](https://cloud.google.com/sql/docs/mysql/sql-proxy). Using Cloud Run Jobs removes that complexity. ### Static compilation -This tutorial opts to use the user's local machine for compiling and uploading static assets. While this could be done in Cloud Run Jobs, this would require building a container with both PHP and NodeJS runtimes. Because NodeJS isn't required for running the service, this isn't required to be in the container. +This tutorial opts to use the user's local machine for compiling and uploading static assets. While this could be done in Cloud Run Jobs, this would require building a container with both PHP and NodeJS runtimes. Because NodeJS isn't required for running the service, this isn't required to be in the container. -### Secrets access +### Secrets access `bootstrap/app.php` includes code to load the mounted secrets, if the folder has been mounted. This relates to the `--set-secrets` command used earlier. (Look for the `cloudrun_laravel_secret_manager_mount` tag.) diff --git a/run/laravel/composer.json b/run/laravel/composer.json index 839b8d4c9f..9ec37e4b6b 100644 --- a/run/laravel/composer.json +++ b/run/laravel/composer.json @@ -5,7 +5,7 @@ "keywords": ["framework", "laravel"], "license": "MIT", "require": { - "php": "^8.0.2", + "php": "^8.1", "google/auth": "^1.24", "google/cloud-core": "^1.46", "guzzlehttp/guzzle": "^7.2", diff --git a/servicedirectory/README.md b/servicedirectory/README.md index 1762476091..f7d2629bec 100644 --- a/servicedirectory/README.md +++ b/servicedirectory/README.md @@ -55,7 +55,7 @@ PHP Fatal error: Uncaught Error: Call to undefined function Google\Protobuf\Int You may need to install the bcmath PHP extension. e.g. (may depend on your php version) ``` -$ sudo apt-get install php8.0-bcmath +$ sudo apt-get install php8.1-bcmath ``` diff --git a/spanner/src/admin/archived/alter_sequence.php b/spanner/src/admin/archived/alter_sequence.php index 05ea5bd84b..f936c6482e 100644 --- a/spanner/src/admin/archived/alter_sequence.php +++ b/spanner/src/admin/archived/alter_sequence.php @@ -40,7 +40,7 @@ function alter_sequence( string $instanceId, string $databaseId - ): void { +): void { $spanner = new SpannerClient(); $instance = $spanner->instance($instanceId); $database = $instance->database($databaseId); diff --git a/spanner/src/admin/archived/alter_table_with_foreign_key_delete_cascade.php b/spanner/src/admin/archived/alter_table_with_foreign_key_delete_cascade.php index 17b6e3e667..b99701c91d 100644 --- a/spanner/src/admin/archived/alter_table_with_foreign_key_delete_cascade.php +++ b/spanner/src/admin/archived/alter_table_with_foreign_key_delete_cascade.php @@ -39,7 +39,7 @@ function alter_table_with_foreign_key_delete_cascade( string $instanceId, string $databaseId - ): void { +): void { $spanner = new SpannerClient(); $instance = $spanner->instance($instanceId); $database = $instance->database($databaseId); diff --git a/spanner/src/admin/archived/create_sequence.php b/spanner/src/admin/archived/create_sequence.php index f4ff6d0cd0..1abcf771a1 100644 --- a/spanner/src/admin/archived/create_sequence.php +++ b/spanner/src/admin/archived/create_sequence.php @@ -40,7 +40,7 @@ function create_sequence( string $instanceId, string $databaseId - ): void { +): void { $spanner = new SpannerClient(); $instance = $spanner->instance($instanceId); $database = $instance->database($databaseId); diff --git a/spanner/src/admin/archived/create_table_with_foreign_key_delete_cascade.php b/spanner/src/admin/archived/create_table_with_foreign_key_delete_cascade.php index 5117cc722e..34c102d358 100644 --- a/spanner/src/admin/archived/create_table_with_foreign_key_delete_cascade.php +++ b/spanner/src/admin/archived/create_table_with_foreign_key_delete_cascade.php @@ -39,7 +39,7 @@ function create_table_with_foreign_key_delete_cascade( string $instanceId, string $databaseId - ): void { +): void { $spanner = new SpannerClient(); $instance = $spanner->instance($instanceId); $database = $instance->database($databaseId); diff --git a/spanner/src/admin/archived/drop_foreign_key_constraint_delete_cascade.php b/spanner/src/admin/archived/drop_foreign_key_constraint_delete_cascade.php index e77f97bb1d..255c0603c9 100644 --- a/spanner/src/admin/archived/drop_foreign_key_constraint_delete_cascade.php +++ b/spanner/src/admin/archived/drop_foreign_key_constraint_delete_cascade.php @@ -39,7 +39,7 @@ function drop_foreign_key_constraint_delete_cascade( string $instanceId, string $databaseId - ): void { +): void { $spanner = new SpannerClient(); $instance = $spanner->instance($instanceId); $database = $instance->database($databaseId); diff --git a/spanner/src/admin/archived/drop_sequence.php b/spanner/src/admin/archived/drop_sequence.php index a2faca07b1..85b4028b3a 100644 --- a/spanner/src/admin/archived/drop_sequence.php +++ b/spanner/src/admin/archived/drop_sequence.php @@ -39,7 +39,7 @@ function drop_sequence( string $instanceId, string $databaseId - ): void { +): void { $spanner = new SpannerClient(); $instance = $spanner->instance($instanceId); $database = $instance->database($databaseId); diff --git a/spanner/src/admin/archived/pg_alter_sequence.php b/spanner/src/admin/archived/pg_alter_sequence.php index 19336abf5b..cc7943406b 100644 --- a/spanner/src/admin/archived/pg_alter_sequence.php +++ b/spanner/src/admin/archived/pg_alter_sequence.php @@ -40,7 +40,7 @@ function pg_alter_sequence( string $instanceId, string $databaseId - ): void { +): void { $spanner = new SpannerClient(); $instance = $spanner->instance($instanceId); $database = $instance->database($databaseId); diff --git a/spanner/src/admin/archived/pg_create_sequence.php b/spanner/src/admin/archived/pg_create_sequence.php index 2ab15f214f..4cb3521436 100644 --- a/spanner/src/admin/archived/pg_create_sequence.php +++ b/spanner/src/admin/archived/pg_create_sequence.php @@ -40,7 +40,7 @@ function pg_create_sequence( string $instanceId, string $databaseId - ): void { +): void { $spanner = new SpannerClient(); $instance = $spanner->instance($instanceId); $database = $instance->database($databaseId); diff --git a/spanner/src/admin/archived/pg_drop_sequence.php b/spanner/src/admin/archived/pg_drop_sequence.php index 9dc6274d59..a0032a3fe5 100644 --- a/spanner/src/admin/archived/pg_drop_sequence.php +++ b/spanner/src/admin/archived/pg_drop_sequence.php @@ -39,7 +39,7 @@ function pg_drop_sequence( string $instanceId, string $databaseId - ): void { +): void { $spanner = new SpannerClient(); $instance = $spanner->instance($instanceId); $database = $instance->database($databaseId); diff --git a/spanner/src/alter_table_with_foreign_key_delete_cascade.php b/spanner/src/alter_table_with_foreign_key_delete_cascade.php index 9b87267cee..6862b8aafd 100644 --- a/spanner/src/alter_table_with_foreign_key_delete_cascade.php +++ b/spanner/src/alter_table_with_foreign_key_delete_cascade.php @@ -42,7 +42,7 @@ function alter_table_with_foreign_key_delete_cascade( string $projectId, string $instanceId, string $databaseId - ): void { +): void { $databaseAdminClient = new DatabaseAdminClient(); $databaseName = DatabaseAdminClient::databaseName($projectId, $instanceId, $databaseId); diff --git a/spanner/src/create_table_with_foreign_key_delete_cascade.php b/spanner/src/create_table_with_foreign_key_delete_cascade.php index 91e945f65a..eaf43bf839 100644 --- a/spanner/src/create_table_with_foreign_key_delete_cascade.php +++ b/spanner/src/create_table_with_foreign_key_delete_cascade.php @@ -42,7 +42,7 @@ function create_table_with_foreign_key_delete_cascade( string $projectId, string $instanceId, string $databaseId - ): void { +): void { $databaseAdminClient = new DatabaseAdminClient(); $databaseName = DatabaseAdminClient::databaseName($projectId, $instanceId, $databaseId); diff --git a/spanner/src/drop_foreign_key_constraint_delete_cascade.php b/spanner/src/drop_foreign_key_constraint_delete_cascade.php index ec637eee0e..6b30553124 100644 --- a/spanner/src/drop_foreign_key_constraint_delete_cascade.php +++ b/spanner/src/drop_foreign_key_constraint_delete_cascade.php @@ -42,7 +42,7 @@ function drop_foreign_key_constraint_delete_cascade( string $projectId, string $instanceId, string $databaseId - ): void { +): void { $databaseAdminClient = new DatabaseAdminClient(); $databaseName = DatabaseAdminClient::databaseName($projectId, $instanceId, $databaseId); diff --git a/spanner/src/drop_sequence.php b/spanner/src/drop_sequence.php index 5436afdde2..2e3cd11dfd 100644 --- a/spanner/src/drop_sequence.php +++ b/spanner/src/drop_sequence.php @@ -42,7 +42,7 @@ function drop_sequence( string $projectId, string $instanceId, string $databaseId - ): void { +): void { $databaseAdminClient = new DatabaseAdminClient(); $databaseName = DatabaseAdminClient::databaseName($projectId, $instanceId, $databaseId); diff --git a/spanner/src/pg_alter_sequence.php b/spanner/src/pg_alter_sequence.php index e344da129c..7e25753625 100644 --- a/spanner/src/pg_alter_sequence.php +++ b/spanner/src/pg_alter_sequence.php @@ -44,7 +44,7 @@ function pg_alter_sequence( string $projectId, string $instanceId, string $databaseId - ): void { +): void { $databaseAdminClient = new DatabaseAdminClient(); $spanner = new SpannerClient(); $instance = $spanner->instance($instanceId); diff --git a/spanner/src/pg_drop_sequence.php b/spanner/src/pg_drop_sequence.php index dfd3234a03..e78200713a 100644 --- a/spanner/src/pg_drop_sequence.php +++ b/spanner/src/pg_drop_sequence.php @@ -42,9 +42,8 @@ function pg_drop_sequence( string $projectId, string $instanceId, string $databaseId - ): void { +): void { $databaseAdminClient = new DatabaseAdminClient(); - $databaseName = DatabaseAdminClient::databaseName($projectId, $instanceId, $databaseId); $statements = [ 'ALTER TABLE Customers ALTER COLUMN CustomerId DROP DEFAULT', diff --git a/storage/src/print_bucket_website_configuration.php b/storage/src/print_bucket_website_configuration.php index 823de6c542..6c5da3dbc6 100644 --- a/storage/src/print_bucket_website_configuration.php +++ b/storage/src/print_bucket_website_configuration.php @@ -41,9 +41,9 @@ function print_bucket_website_configuration(string $bucketName): void printf('Bucket website configuration not set' . PHP_EOL); } else { printf( - 'Index page: %s' . PHP_EOL . '404 page: %s' . PHP_EOL, - $info['website']['mainPageSuffix'], - $info['website']['notFoundPage'], + 'Index page: %s' . PHP_EOL . '404 page: %s' . PHP_EOL, + $info['website']['mainPageSuffix'], + $info['website']['notFoundPage'], ); } } diff --git a/testing/composer.json b/testing/composer.json index a39308fd69..8ca6b9699b 100755 --- a/testing/composer.json +++ b/testing/composer.json @@ -1,6 +1,6 @@ { "require": { - "php": "^8.0" + "php": "^8.1" }, "require-dev": { "bshaffer/phpunit-retry-annotations": "^0.3.0", @@ -8,7 +8,7 @@ "google/cloud-tools": "dev-main", "guzzlehttp/guzzle": "^7.0", "phpunit/phpunit": "^9.0", - "friendsofphp/php-cs-fixer": "^3,<3.9", + "friendsofphp/php-cs-fixer": "^3.29", "composer/semver": "^3.2", "phpstan/phpstan": "^1.10", "phpspec/prophecy-phpunit": "^2.0"