### Start WordPress Environment (Bash) Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/README.md Starts a local WordPress development environment using @wordpress/env. This command requires Docker to be installed and running. ```bash $ wp-env start ``` -------------------------------- ### Install npm Packages (Bash) Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/README.md Installs Node.js packages required for theme development. It includes a workaround for potential Sass installation issues by aliasing `node-sass` to `sass`. ```bash $ npm install # If you face issues installing Sass, try the following command, and # npm install again. $ npm install node-sass@npm:sass $ npm install ``` -------------------------------- ### Set Up gax-php Repository and Install Dependencies Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/gax/README.md This code demonstrates the steps to set up the gax-php repository locally and install its project dependencies using Composer. It assumes you have already installed the base dependencies. ```bash > cd /path/to/gax-php > cp ~/composer.phar ./ > php composer.phar install ``` -------------------------------- ### Install WordPress Abilities API and MCP Adapter with Composer Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/vendor/wordpress/mcp-adapter/README.md This command installs both the WordPress Abilities API and the MCP Adapter as Composer dependencies. This is the primary and recommended installation method for integrating these packages into your project. ```bash composer require wordpress/abilities-api wordpress/mcp-adapter ``` -------------------------------- ### Install Dependencies for gax-php on Linux Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/gax/README.md This snippet outlines the commands to install necessary dependencies for setting up the gax-php library on a Linux system. It includes installing PHP, PHP extensions, Composer, and the protobuf PECL extension. ```bash > cd ~/ > sudo apt-get install php php-dev libcurl3-openssl-dev php-pear php-bcmath php-xml > curl -sS https://getcomposer.org/installer | php > sudo pecl install protobuf ``` -------------------------------- ### Install PHP and Composer Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/grpc-gcp/doc/gRPC-client-user-guide.md Installs PHP (version 5.5 or higher, preferably 7.0+) and Composer, a dependency manager for PHP, on a Linux system. ```shell $ [sudo] apt-get install php php-dev $ curl -sS https://getcomposer.org/installer | php $ [sudo] mv composer.phar /usr/local/bin/composer ``` -------------------------------- ### Build Theme Assets (Bash) Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/README.md Compiles and builds theme assets using npm scripts. This command is typically used after installing dependencies to prepare the theme's frontend files. ```bash $ npm run build ``` -------------------------------- ### Build and Install gRPC and Protobuf Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/grpc-gcp/doc/gRPC-client-user-guide.md Compiles and installs the gRPC library and protobuf components from source, which includes generating the grpc_php_plugin necessary for PHP gRPC development. ```shell $ git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc $ cd grpc $ git submodule update --init # install protobuf $ cd third_party/protobuf $ ./autogen.sh && ./configure && make -j8 $ [sudo] make install $ [sudo] ldconfig # install gRPC $ cd ../.. $ make -j8 $ [sudo] make install ``` -------------------------------- ### Install Google Auth Library for PHP using Composer Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/auth/README.md This snippet shows how to install the Google Auth Library for PHP using Composer. It first demonstrates installing Composer itself and then adding the library to your project. ```bash curl -sS https://getcomposer.org/installer | php composer.phar require google/auth ``` -------------------------------- ### Install Composer Dependencies (Bash) Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/README.md Installs PHP packages managed by Composer, typically for WordPress MU plugins. This ensures all necessary backend components are available. ```bash $ composer install ``` -------------------------------- ### Install Linux Build Dependencies Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/grpc-gcp/doc/gRPC-client-user-guide.md Installs essential build tools and libraries required for compiling software on a Linux system, such as gRPC and protobuf. ```shell $ [sudo] apt-get install build-essential autoconf libtool pkg-config zip unzip zlib1g-dev ``` -------------------------------- ### Install PHP gRPC and Protobuf Extensions Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/grpc-gcp/doc/gRPC-client-user-guide.md Installs the PHP gRPC and Protobuf extensions using PECL, enabling PHP to interact with gRPC services and handle Protocol Buffers. ```shell $ [sudo] pecl install protobuf $ [sudo] pecl install grpc ``` -------------------------------- ### Install Monolog using Composer Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/monolog/monolog/README.md This command installs the latest version of the Monolog library using the Composer package manager. Ensure Composer is installed and configured in your project. ```bash composer require monolog/monolog ``` -------------------------------- ### Install @wordpress/env Globally (Bash) Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/README.md Installs the @wordpress/env package globally, which is a tool for scaffolding and managing local WordPress development environments. This command requires npm. ```bash $ npm install -g @wordpress/env@latest ``` -------------------------------- ### Clone MCP Adapter from GitHub for Development Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/vendor/wordpress/mcp-adapter/README.md Clones the MCP Adapter repository from GitHub to install the latest development version. This method is useful for contributing to the project or using the most recent code, followed by installing its dependencies. ```bash # Clone the repository git clone https://github.com/WordPress/mcp-adapter.git wp-content/plugins/mcp-adapter # Navigate to the plugin directory cd wp-content/plugins/mcp-adapter # Install dependencies composer install ``` -------------------------------- ### Initialize MCP Adapter in WordPress Plugin Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/vendor/wordpress/mcp-adapter/README.md Demonstrates how to check for the existence of the MCP Adapter class and then initialize its singleton instance within your WordPress plugin. This is the standard way to start using the adapter's functionality. ```php use WP\MCP\Core\McpAdapter; // 1. Check if MCP Adapter is available if ( ! class_exists( McpAdapter::class ) ) { // Handle missing dependency (show admin notice, etc.) return; } // 2. Initialize the adapter McpAdapter::instance(); // That's it! ``` -------------------------------- ### Install Entire Google Cloud PHP Suite with Composer Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/cloud-vision/README.md Installs the complete suite of Google Cloud PHP client libraries using Composer. This is useful for projects requiring multiple Google Cloud services. ```sh composer require google/cloud ``` -------------------------------- ### Install Guzzle using Composer (Bash) Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/guzzlehttp/guzzle/README.md Provides the command to install the Guzzle HTTP client using Composer, the dependency manager for PHP. This is the recommended method for adding Guzzle to your project. ```bash composer require guzzlehttp/guzzle ``` -------------------------------- ### Download Locale SQL File (Bash) Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/README.md Downloads the SQL file containing locale data using curl. This file is required for the locale database setup in WordPress. ```bash curl -O https://raw.githubusercontent.com/WordPress/pattern-directory/trunk/.wp-env/data/wporg_locales.sql ``` -------------------------------- ### Install crc32c.so PECL Extension (TODO) Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/crc32/README.md This is a placeholder command for installing the crc32c PECL extension. Actual installation might involve `pecl install crc32c` or manual compilation. ```shell TODO pecl install crc32c ``` -------------------------------- ### Guzzle Request Option Configuration Example Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/guzzlehttp/guzzle/UPGRADING.md Demonstrates the migration from using command-specific options like 'command.headers' and 'command.response_body' to the new 'request.options' parameter in Guzzle 3.7. This change standardizes request configuration. ```php getCommand('foo', array( 'command.headers' => array('Test' => '123'), 'command.response_body' => '/path/to/file' )); // New way (Guzzle 3.7 onwards) $command = $client->getCommand('foo', array( 'command.request_options' => array( 'headers' => array('Test' => '123'), 'save_as' => '/path/to/file' ) )); ?> ``` -------------------------------- ### Install Composer Dependencies in Bash Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpressfoundation.org/public_html/content/plugins/wpf-stripe/stripe-php/README.md Install project dependencies using Composer, which is required for the Stripe PHP library and its testing framework (PHPUnit). This command fetches and installs all necessary packages listed in `composer.json`. ```bash composer install ``` -------------------------------- ### Install Entire Google Cloud PHP Suite with Composer Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/cloud-storage/README.md Installs the entire suite of Google Cloud PHP components using Composer. This command is useful if you plan to use multiple Google Cloud services in your PHP project. ```sh $ composer require google/cloud ``` -------------------------------- ### Install Stripe PHP Bindings via Composer Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpressfoundation.org/public_html/content/plugins/wpf-stripe/stripe-php/README.md Installs the Stripe PHP library using Composer, the recommended dependency manager for PHP. This command fetches the latest stable version and adds it to your project's dependencies. ```bash composer require stripe/stripe-php ``` -------------------------------- ### Install Jetpack Autoloader with Composer Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/vendor/wordpress/mcp-adapter/README.md Installs the Jetpack Autoloader package using Composer. This is highly recommended when multiple plugins use the MCP Adapter to prevent version conflicts by ensuring only the latest version of shared packages is loaded. ```bash composer require automattic/jetpack-autoloader ``` -------------------------------- ### Manual Installation of Stripe PHP Bindings Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpressfoundation.org/public_html/content/plugins/wpf-stripe/stripe-php/README.md Includes the Stripe PHP library manually by directly referencing the init.php file. This method is an alternative to Composer and requires you to manage the library's location. ```php require_once('/path/to/stripe-php/init.php'); ``` -------------------------------- ### Configure wp-env for MCP Adapter and Abilities API Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/vendor/wordpress/mcp-adapter/README.md Example configuration for `.wp-env.json` to include the WordPress Abilities API and MCP Adapter as plugins. This is used for setting up a local WordPress development environment with `wp-env`. ```json { "$schema": "https://schemas.wp.org/trunk/wp-env.json", // ... other config ... "plugins": [ "WordPress/abilities-api", "WordPress/mcp-adapter", // ... other plugins ... ], // ... more config ... } ``` -------------------------------- ### Install PSR Log via Composer Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/psr/log/README.md This command installs the PSR-3 logger interface package using Composer, the dependency manager for PHP. It ensures that your project can utilize the standard logging interfaces. ```bash composer require psr/log ``` -------------------------------- ### Make Local Requests with Curl Source: https://github.com/wordpress/wordpress.org/blob/trunk/common/includes/slack/props/readme.md Example of making a local request to the ngrok-proxied sandbox using curl. Requires the ngrok URL and the configured username/password for authentication. ```bash curl {ngrok url}/events/1.0/?location=Seattle&number=1 ``` -------------------------------- ### Install Dependencies and Activate Theme Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/README.md Installs project dependencies using Composer and builds all theme projects using Yarn. It also includes an optional step to activate the pattern-directory theme using the WP-CLI. ```shell composer install ``` ```shell composer update ``` ```shell yarn workspaces build ``` ```shell yarn wp-env run cli "theme activate pattern-directory" ``` -------------------------------- ### Serve Happy API - PHP Version Compatibility Check Source: https://context7.com/wordpress/wordpress.org/llms.txt Validates PHP version compatibility for WordPress installations, returning minimum and recommended PHP versions. ```APIDOC ## GET /core/serve-happy/1.0/ ### Description Validates PHP version compatibility for WordPress installations, returning minimum and recommended PHP versions. ### Method GET ### Endpoint `/core/serve-happy/1.0/` ### Query Parameters - **php_version** (string) - Required - The PHP version to check. ### Request Example ```bash curl "https://api.wordpress.org/core/serve-happy/1.0/?php_version=7.4.33" ``` ### Response #### Success Response (200) - **recommended_version** (string) - The recommended PHP version. - **minimum_version** (string) - The minimum supported PHP version. - **is_supported** (boolean) - Whether the provided PHP version is supported. - **is_secure** (boolean) - Whether the provided PHP version is considered secure. - **is_acceptable** (boolean) - Whether the provided PHP version is acceptable. #### Response Example ```json { "recommended_version": "8.2", "minimum_version": "7.2.24", "is_supported": true, "is_secure": true, "is_acceptable": true } ``` ``` -------------------------------- ### Start CSS Build with Grunt Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg/README.md Initiates the build process for CSS files, compiling Sass from parent and child themes. Requires Node.js and Grunt.js. ```shell grunt css ``` -------------------------------- ### Configure .htaccess for @wordpress/env (Bash) Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/README.md Sets up the .htaccess file within a @wordpress/env development environment to prevent Apache 404 errors. This is done by redirecting all requests to index.php. ```bash $ wp-env run cli bash bash-5.1$ printf "RewriteEngine on\nFallbackResource /index.php\n" > .htaccess bash-5.1$ exit ``` -------------------------------- ### PHP CRC32 Usage Example Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/crc32/README.md Demonstrates how to create and use a CRC32 object in PHP. It initializes a CRC32 object, updates it with data, and retrieves the hash. This example requires the google/crc32 library to be installed via Composer. ```php require 'vendor/autoload.php'; use Google\CRC32\CRC32; $crc = CRC32::create(CRC32::CASTAGNOLI); $crc->update('hello'); echo $crc->hash(); ``` -------------------------------- ### Interact with MCP Servers via STDIO Transport Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/vendor/wordpress/mcp-adapter/README.md These bash commands demonstrate how to interact with MCP servers using WP-CLI for testing purposes. They show how to list available MCP servers, test the 'discover abilities' tool to view registered WordPress abilities, and list available tools on a server. ```bash # List all available MCP servers wp mcp-adapter list ``` ```bash # Test the discover abilities tool to see all available WordPress abilities echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"mcp-adapter-discover-abilities","arguments":{}}}' | wp mcp-adapter serve --user=admin --server=mcp-adapter-default-server ``` ```bash # Test listing available tools echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | wp mcp-adapter serve --user=admin --server=mcp-adapter-default-server ``` -------------------------------- ### Install php-crc32 using Composer Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/crc32/README.md Provides the Composer command to install the google/crc32 library. This is the standard method for managing PHP dependencies. ```shell $ composer require google/crc32 ``` -------------------------------- ### Composer Installation for URI Template (JSON) Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/rize/uri-template/README.md Provides the composer.json dependency configuration required to install the Rize URI Template library. ```json { "require": { "rize/uri-template": "~0.3" } } ``` -------------------------------- ### Run Tests for gax-php Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/gax/README.md This command executes the test suite for the gax-php library using PHPUnit. It specifies the bootstrap file and the directory containing the tests. ```bash > vendor/bin/phpunit --bootstrap tests/bootstrap.php tests ``` -------------------------------- ### Basic Stripe Charge Creation in PHP Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpressfoundation.org/public_html/content/plugins/wpf-stripe/stripe-php/README.md Demonstrates a simple example of creating a charge using the Stripe PHP library. It requires setting your API key and then calling the `create` method on the `Charge` class with payment details. ```php \Stripe\Stripe::setApiKey('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); $charge = \Stripe\Charge::create(['amount' => 2000, 'currency' => 'usd', 'source' => 'tok_189fqt2eZvKYlo2CTGBeg6Uq']); echo $charge; ``` -------------------------------- ### Chaining Markdown and SmartyPants in PHP Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/libs/michelf-php-markdown-1.6.0/Readme.md This example illustrates how to combine PHP Markdown Lib with another text filter, SmartyPants, to further process the generated HTML. The Markdown transformation should be performed first, followed by the SmartyPants transformation. ```php use \Michelf\Markdown, \Michelf\SmartyPants; $my_text = "Let's make this text 'smart'."; $my_html = Markdown::defaultTransform($my_text); $my_html = SmartyPants::defaultTransform($my_html); // $my_html will contain HTML with smart typography ``` -------------------------------- ### Install wporg Parent Theme via SVN Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/README.md Installs the wporg parent theme from the WordPress.org SVN repository to a specified local path. This is an alternative to using Composer for dependency management. ```shell svn co https://meta.svn.wordpress.org/sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg path/to/wp-content/themes/wporg ``` -------------------------------- ### Install PHP-JWT using Composer Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/firebase/php-jwt/README.md This command installs the PHP-JWT library using Composer, the dependency manager for PHP. It ensures the library is available for use in your project. ```bash composer require firebase/php-jwt ``` -------------------------------- ### Run Stripe Mock Server Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpressfoundation.org/public_html/content/plugins/wpf-stripe/stripe-php/README.md Set up and run `stripe-mock`, a local mock server for Stripe, which is a dependency for the test suite. This allows for testing Stripe integrations without making actual API calls. ```bash go get -u github.com/stripe/stripe-mock stripe-mock ``` -------------------------------- ### Register a WordPress Ability with MCP Adapter Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/vendor/wordpress/mcp-adapter/README.md This PHP code snippet demonstrates how to register a new WordPress ability using the `wp_register_ability()` function. It defines the ability's label, description, input and output schemas, an execution callback, and a permission callback. The ability becomes automatically available via the default MCP server without further configuration. ```php add_action( 'wp_abilities_api_init', function() { wp_register_ability( 'my-plugin/get-posts', [ 'label' => 'Get Posts', 'description' => 'Retrieve WordPress posts with optional filtering', 'input_schema' => [ 'type' => 'object', 'properties' => [ 'numberposts' => [ 'type' => 'integer', 'description' => 'Number of posts to retrieve', 'default' => 5, 'minimum' => 1, 'maximum' => 100 ], 'post_status' => [ 'type' => 'string', 'description' => 'Post status to filter by', 'enum' => ['publish', 'draft', 'private'], 'default' => 'publish' ] ] ], 'output_schema' => [ 'type' => 'array', 'items' => [ 'type' => 'object', 'properties' => [ 'ID' => ['type' => 'integer'], 'post_title' => ['type' => 'string'], 'post_content' => ['type' => 'string'], 'post_date' => ['type' => 'string'], 'post_author' => ['type' => 'string'] ] ] ], 'execute_callback' => function( $input ) { $args = [ 'numberposts' => $input['numberposts'] ?? 5, 'post_status' => $input['post_status'] ?? 'publish' ]; return get_posts( $args ); }, 'permission_callback' => function() { return current_user_can( 'read' ); } ]); }); // The ability is automatically available via the default MCP server // No additional configuration needed! ``` -------------------------------- ### Guzzle Client Configuration (PHP) Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/guzzlehttp/guzzle/UPGRADING.md Illustrates how to set default request options like User-Agent and SSL verification in Guzzle 4.0, replacing the removed set methods. ```php $client->setConfig('defaults/headers/User-Agent', 'Foo/Bar ' . $client::getDefaultUserAgent()); $client->setConfig('defaults/verify', true); ``` -------------------------------- ### Install Google Cloud Core PHP Library Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/cloud-core/README.md Installs the Google Cloud Core library for PHP using Composer. This package provides common infrastructure for other Google Cloud PHP components and is not intended for direct use. ```sh $ composer require google/cloud-core ``` -------------------------------- ### Install gRPC-PHP Composer Library and Configure Autoloading Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/grpc-gcp/doc/gRPC-client-user-guide.md This snippet demonstrates how to add the 'google/cloud' library to your project's composer.json file and configure PSR-4 autoloading for your Firestore service classes. Ensure you adjust the paths and namespaces to match your project structure. ```json { "require": { "google/cloud": "^0.52.1" }, "autoload": { "psr-4": { "FireStore\": "src/", "Google\Cloud\Firestore\V1beta1\": "Google/Cloud/Firestore/V1beta1/" } } } ``` -------------------------------- ### Install Google Cloud Vision PHP Component with Composer Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/cloud-vision/README.md Installs the Google Cloud Vision PHP client library using Composer, the dependency manager for PHP. This command adds the necessary package to your project's dependencies. ```sh composer require google/cloud-vision ``` -------------------------------- ### Install Google Cloud Storage PHP Component with Composer Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/cloud-storage/README.md Installs the Google Cloud Storage PHP component using Composer, the preferred dependency manager for PHP. This command adds the necessary package to your project's 'composer.json' file. ```sh $ composer require google/cloud-storage ``` -------------------------------- ### Call Google Services with Specific JSON Key (PHP) Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/auth/README.md This example demonstrates how to authenticate API calls using a specific JSON key file instead of the `GOOGLE_APPLICATION_CREDENTIALS` environment variable. It uses `CredentialsLoader::makeCredentials` and `AuthTokenMiddleware` with the Guzzle HTTP client. ```php use Google\Auth\CredentialsLoader; use Google\Auth\Middleware\AuthTokenMiddleware; use GuzzleHttp\Client; use GuzzleHttp\HandlerStack; // Define the Google Application Credentials array $jsonKey = ['key' => 'value']; // define the scopes for your API call $scopes = ['https://www.googleapis.com/auth/drive.readonly']; // Load credentials $creds = CredentialsLoader::makeCredentials($scopes, $jsonKey); // optional caching // $creds = new FetchAuthTokenCache($creds, $cacheConfig, $cache); // create middleware $middleware = new AuthTokenMiddleware($creds); $stack = HandlerStack::create(); $stack->push($middleware); // create the HTTP client $client = new Client([ 'handler' => $stack, 'base_uri' => 'https://www.googleapis.com', 'auth' => 'google_auth' // authorize all requests ]); // make the request $response = $client->get('drive/v2/files'); // show the result! print_r((string) $response->getBody()); ``` -------------------------------- ### Generate gRPC Client API with protoc Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/vendor/google/grpc-gcp/doc/gRPC-client-user-guide.md Generates PHP client API code from .proto files using the protoc compiler and the grpc_php_plugin. Requires specifying proto paths and output directories. ```shell $ mkdir $HOME/project $ protoc --proto_path=./ --php_out=$HOME/project \ --grpc_out=$HOME/project \ --plugin=protoc-gen-grpc=./bins/opt/grpc_php_plugin \ path/to/your/proto_dependency_directory1/*.proto \ path/to/your/proto_dependency_directory2/*.proto \ path/to/your/proto_directory/*.proto ``` -------------------------------- ### Build Theme Assets with Yarn Source: https://github.com/wordpress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/README.md Builds the CSS files for the theme. Running `yarn start` in the theme directory or `yarn workspaces wporg-pattern-directory-theme start` anywhere in the project initiates a watch script for continuous development with sourcemapping. `yarn workspaces build` generates production-ready files. ```shell yarn start ``` ```shell yarn workspaces wporg-pattern-directory-theme start ``` ```shell yarn workspaces build ```