### Simple Stripe PHP Charge Example Source: https://github.com/phacility/phabricator/blob/master/externals/stripe-php/README.rdoc A basic example demonstrating how to set your Stripe API key and create a charge using the Stripe PHP bindings. Ensure you replace placeholder values with your actual credentials and card details. ```php Stripe::setApiKey('d8e8fca2dc0f896fd7cb4cb0031ba249'); $myCard = array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2015); $charge = Stripe_Charge::create(array('card' => $myCard, 'amount' => 2000, 'currency' => 'usd')); echo $charge; ``` -------------------------------- ### Configuration JSON Example Source: https://github.com/phacility/phabricator/blob/master/src/applications/differential/parser/__tests__/messages/normal.txt This JSON object represents a sample configuration structure for the Phabricator project. It includes fields for title, summary, test plan, and reviewers. ```json { "title": "title", "summary": "summary", "test plan": "test plan", "reviewers": "reviewers" } ``` -------------------------------- ### Manually Install Stripe PHP Bindings Source: https://github.com/phacility/phabricator/blob/master/externals/stripe-php/README.rdoc Instructions for manually cloning the Stripe PHP bindings repository from GitHub and including the Stripe.php file in your project. ```bash git clone https://github.com/stripe/stripe-php ``` ```php require_once("/path/to/stripe-php/lib/Stripe.php"); ``` -------------------------------- ### Install Stripe PHP Bindings via Composer Source: https://github.com/phacility/phabricator/blob/master/externals/stripe-php/README.rdoc This snippet shows how to add the Stripe PHP bindings to your project's composer.json file and install them using Composer. This is the recommended method for managing dependencies. ```json { "require": { "stripe/stripe-php": "1.*" } } ``` ```bash composer.phar install ``` -------------------------------- ### Install Octicons via NPM Source: https://github.com/phacility/phabricator/blob/master/externals/octicons/README.md Command to install the octicons package as a project dependency using npm. ```bash npm install --save octicons ``` -------------------------------- ### Run Stripe PHP Tests Source: https://github.com/phacility/phabricator/blob/master/externals/stripe-php/README.rdoc This snippet shows how to install the SimpleTest library via Composer and then run the Stripe PHP test suite. This is useful for verifying the library's functionality. ```bash composer.phar update --dev ``` ```bash php ./test/Stripe.php ``` -------------------------------- ### Use a Saved Query for Maniphest Tasks (cURL) Source: https://context7.com/phacility/phabricator/llms.txt This example shows how to use a saved query to retrieve Maniphest tasks. It requires an API token and a query key, such as 'assigned'. ```bash curl https://phabricator.example.com/api/maniphest.search \ -d api.token=api-tokenxxxxxx \ -d queryKey=assigned ``` -------------------------------- ### Get Octicon Symbol Name Source: https://github.com/phacility/phabricator/blob/master/externals/octicons/README.md Demonstrates how to retrieve the string name of an Octicon, using 'x' as an example. ```javascript octicons.x.symbol; ``` -------------------------------- ### Get Octicon Keywords Source: https://github.com/phacility/phabricator/blob/master/externals/octicons/README.md Example of retrieving an array of keywords associated with an Octicon. The 'x' icon is used to show its associated keywords like 'remove', 'close', and 'delete'. ```javascript octicons.x.keywords; ``` -------------------------------- ### Search for Differential Revisions (cURL) Source: https://context7.com/phacility/phabricator/llms.txt This example shows how to search for differential revisions. You can filter by status (e.g., 'needs-review') and reviewers, or retrieve a specific revision by its ID and include attachments like reviewers and subscribers. ```bash curl https://phabricator.example.com/api/differential.revision.search \ -d api.token=api-tokenxxxxxx \ -d 'constraints[statuses][0]=needs-review' \ -d 'constraints[reviewerPHIDs][0]=PHID-USER-reviewer1' ``` ```bash curl https://phabricator.example.com/api/differential.revision.search \ -d api.token=api-tokenxxxxxx \ -d 'constraints[ids][0]=1234' \ -d 'attachments[reviewers]=1' \ -d 'attachments[subscribers]=1' ``` -------------------------------- ### Display Code Diff in Phabricator (diff) Source: https://github.com/phacility/phabricator/blob/master/src/infrastructure/markup/remarkup/__tests__/remarkup/diff.txt This snippet shows how to represent a code diff using Phabricator's remarkup. It utilizes the 'diff' language identifier to enable syntax highlighting and proper formatting for diff output. No external dependencies are required, as this is a built-in remarkup feature. ```diff @@ derp derp @@ x y - x - y + z ``` -------------------------------- ### Phabricator Unbundle Command Example Source: https://github.com/phacility/phabricator/blob/master/src/applications/diffusion/ssh/__tests__/hgwiredata/unbundle.txt Demonstrates the 'unbundle' command with its 'heads' argument. This command is used to process bundled data within Phabricator. ```json [ { "command" : "unbundle", "arguments" : { "heads" : "686173686564 8022e00be6886fcf1be8f57f96c78aa924967f83" }, "raw" : "unbundle\nheads 53\n686173686564 8022e00be6886fcf1be8f57f96c78aa924967f83" }, { "command" : "", "raw" : "20\naaaaaaaaaaaaaaaaaaaa" }, { "command" : "", "raw" : "20\nbbbbbbbbbbbbbbbbbbbb" }, { "command" : "", "raw" : "0\n" } ] ``` -------------------------------- ### SQL Query Example Source: https://github.com/phacility/phabricator/blob/master/src/infrastructure/markup/remarkup/__tests__/remarkup/monospaced-in-monospaced.txt This snippet shows a basic SQL SELECT query. It is presented within Phabricator's remarkup formatting, using backticks for monospaced text. The query selects all columns from a table named 'table'. ```sql SELECT * FROM `table` ``` -------------------------------- ### Access Octicon Data in Node.js Source: https://github.com/phacility/phabricator/blob/master/externals/octicons/README.md Example of how to require the octicons library in a Node.js environment and access individual icon data, such as the 'alert' icon. This demonstrates accessing properties like keywords, path, height, width, symbol, and options. ```javascript var octicons = require("octicons"); octicons.alert; ``` -------------------------------- ### Build Octicons using npm Source: https://github.com/phacility/phabricator/blob/master/externals/octicons/README.md This command is used to build the Octicons library after making changes to the SVG files. It installs project dependencies and then runs a build script to regenerate the SVG assets. This process ensures that the icons are up-to-date and ready for use. ```bash npm install npm run build ``` -------------------------------- ### SQL Table Reference Example Source: https://github.com/phacility/phabricator/blob/master/src/infrastructure/markup/remarkup/__tests__/remarkup/monospaced-in-monospaced.txt This snippet demonstrates referencing a table name within an SQL query using Phabricator's remarkup syntax. The double hash symbols (##) around 'table' are likely part of a templating or variable substitution mechanism within Phabricator, indicating a dynamic table name. ```sql SELECT * FROM ##table## ``` -------------------------------- ### Get Octicon Path Data Source: https://github.com/phacility/phabricator/blob/master/externals/octicons/README.md Shows how to extract the SVG path data string for a specific Octicon, using the 'x' icon as an example. ```javascript octicons.x.path; ``` -------------------------------- ### Get Octicon SVG Options Source: https://github.com/phacility/phabricator/blob/master/externals/octicons/README.md Illustrates how to access the default options object for an Octicon, which includes attributes like version, width, height, viewBox, class, and aria-hidden. The 'x' icon is used as an example. ```javascript octicons.x.options; ``` -------------------------------- ### Install Porter Stemmer with Composer Source: https://github.com/phacility/phabricator/blob/master/externals/porter-stemmer/README.md Installs the camspiers/porter-stemmer package using Composer. This requires Composer to be installed and accessible in your project's root directory. ```json { "require": { "camspiers/porter-stemmer": "1.0.0" } } ``` ```bash $ composer install ``` -------------------------------- ### Project API - Create and Edit Projects Source: https://context7.com/phacility/phabricator/llms.txt The `project.edit` method enables creating and modifying projects, including setting names, descriptions, colors, icons, and member lists. ```APIDOC ## POST /api/project.edit ### Description Creates or modifies projects in Phabricator. This method allows for setting project attributes such as name, description, icon, color, and managing members. ### Method POST ### Endpoint https://phabricator.example.com/api/project.edit ### Parameters #### Query Parameters - **api_token** (string) - Required - Your API authentication token. - **objectIdentifier** (string) - Optional - The PHID of the project to edit. If not provided, a new project is created. #### Request Body - **transactions** (array of objects) - Required - A list of transaction objects to apply to the project. Each object contains: - **type** (string) - Required - The type of transaction (e.g., `name`, `description`, `icon`, `color`, `members.add`, `members.remove`). - **value** (any) - Required - The value for the transaction. The format depends on the `type`. - For `name`, `description`, `icon`, `color`: string - For `members.add`, `members.remove`: array of user PHIDs (strings) ### Request Example ```json { "api_token": "api-tokenxxxxxx", "transactions": [ { "type": "name", "value": "Backend Team" }, { "type": "description", "value": "Backend development and API work" }, { "type": "icon", "value": "group" }, { "type": "color", "value": "blue" }, { "type": "members.add", "value": [ "PHID-USER-dev1", "PHID-USER-dev2" ] } ] } ``` ### Response #### Success Response (200) - **result** (object) - Contains details about the created or modified project and the transactions applied. - **object** (object) - Information about the project. - **id** (integer) - The project's unique ID. - **phid** (string) - The project's unique PHID. - **transactions** (array of objects) - A list of applied transaction PHIDs. - **phid** (string) - The PHID of the transaction. #### Response Example ```json { "result": { "object": { "id": 42, "phid": "PHID-PROJ-backend123" }, "transactions": [ {"phid": "PHID-XACT-PROJ-111"}, {"phid": "PHID-XACT-PROJ-222"} ] }, "error_code": null, "error_info": null } ``` ``` -------------------------------- ### Phabricator Project API - Create and Edit Projects Source: https://context7.com/phacility/phabricator/llms.txt The `project.edit` method allows for the creation and modification of projects. You can set project attributes such as name, description, icon, color, and manage member lists. It requires an API token and transaction data specifying the changes. ```bash curl https://phabricator.example.com/api/project.edit \ -d api.token=api-tokenxxxxxx \ -d 'transactions[0][type]=name' \ -d 'transactions[0][value]=Backend Team' \ -d 'transactions[1][type]=description' \ -d 'transactions[1][value]=Backend development and API work' \ -d 'transactions[2][type]=icon' \ -d 'transactions[2][value]=group' \ -d 'transactions[3][type]=color' \ -d 'transactions[3][value]=blue' \ -d 'transactions[4][type]=members.add' \ -d 'transactions[4][value][0]=PHID-USER-dev1' \ -d 'transactions[4][value][1]=PHID-USER-dev2' ``` ```bash curl https://phabricator.example.com/api/project.edit \ -d api.token=api-tokenxxxxxx \ -d objectIdentifier=PHID-PROJ-backend123 \ -d 'transactions[0][type]=members.add' \ -d 'transactions[0][value][0]=PHID-USER-newmember' ``` -------------------------------- ### Phabricator Project API - Search Projects Source: https://context7.com/phacility/phabricator/llms.txt The `project.search` method is used to retrieve project information. It supports filtering projects by various criteria including name, slug, and members. An API token is required for authentication. ```bash curl https://phabricator.example.com/api/project.search \ -d api.token=api-tokenxxxxxx \ -d 'constraints[query]=backend' \ -d 'attachments[members]=1' ``` ```bash curl https://phabricator.example.com/api/project.search \ -d api.token=api-tokenxxxxxx \ -d 'constraints[slugs][0]=backend_team' ``` -------------------------------- ### Empty Data Structure Example Source: https://github.com/phacility/phabricator/blob/master/src/applications/differential/parser/__tests__/messages/normal.txt This represents an empty array, typically used to signify no data or an empty list in JSON contexts. ```json [] ``` -------------------------------- ### Search for Diffusion Repositories (cURL) Source: https://context7.com/phacility/phabricator/llms.txt This snippet demonstrates how to search for repositories using the `diffusion.repository.search` API. You can filter by status (e.g., 'active') or by repository callsign/name, and optionally request attachments like URIs. ```bash curl https://phabricator.example.com/api/diffusion.repository.search \ -d api.token=api-tokenxxxxxx \ -d 'constraints[status]=active' ``` ```bash curl https://phabricator.example.com/api/diffusion.repository.search \ -d api.token=api-tokenxxxxxx \ -d 'constraints[callsigns][0]=APP' \ -d 'attachments[uris]=1' ``` -------------------------------- ### Phabricator File API - Download Files Source: https://context7.com/phacility/phabricator/llms.txt The `file.download` method allows retrieval of file contents from Phabricator. The file data is returned as a base64-encoded string, which can then be decoded to obtain the original file. ```bash curl https://phabricator.example.com/api/file.download \ -d api.token=api-tokenxxxxxx \ -d phid=PHID-FILE-abc123xyz | \ jq -r '.result' | base64 -d > downloaded_file.png ``` -------------------------------- ### Phabricator getbundle Command Usage (JSON) Source: https://github.com/phacility/phabricator/blob/master/src/applications/diffusion/ssh/__tests__/hgwiredata/getbundle.txt This snippet shows the structure of the 'getbundle' command within a JSON object. It includes the command name, arguments, and the raw command string. This format is typically used for API interactions or configuration files. ```json [ { "command" : "getbundle", "arguments" : { "*" : { "common" : "0000000000000000000000000000000000000000", "heads" : "7cb27ad591d60500c020283b81c6467540218eda 1036b72db89a0451fa82fcd5462d903f591f0a3c 0b9d8290c4e067a0b91b43062ee9de392e8fae88" } }, "raw" : "getbundle\n* 2\ncommon 40\n0000000000000000000000000000000000000000heads 122\n7cb27ad591d60500c020283b81c6467540218eda 1036b72db89a0451fa82fcd5462d903f591f0a3c 0b9d8290c4e067a0b91b43062ee9de392e8fae88" } ] ``` -------------------------------- ### user.whoami - Get Current User Information Source: https://context7.com/phacility/phabricator/llms.txt The `user.whoami` method retrieves details about the currently authenticated user. This includes their username, real name, unique PHID, profile image URL, and assigned roles. ```APIDOC ## POST /api/user.whoami ### Description Retrieves information about the currently authenticated user. ### Method POST ### Endpoint /api/user.whoami ### Parameters #### Query Parameters - **api.token** (string) - Required - Your Phabricator API token. ### Request Example ```bash curl https://phabricator.example.com/api/user.whoami \ -d api.token=api-tokenxxxxxx ``` ### Response #### Success Response (200) - **result** (object) - Contains user information: - **phid** (string) - The user's unique Phabricator ID. - **userName** (string) - The user's username. - **realName** (string) - The user's real name. - **image** (string) - URL to the user's profile image. - **uri** (string) - URL to the user's profile. - **roles** (array) - List of roles assigned to the user. - **primaryEmail** (string) - The user's primary email address. - **error_code** (null) - Indicates no error occurred. - **error_info** (null) - Provides error details if an error occurred. #### Response Example ```json { "result": { "phid": "PHID-USER-abc123", "userName": "johndoe", "realName": "John Doe", "image": "https://phabricator.example.com/file/data/xyz/profile.png", "uri": "https://phabricator.example.com/p/johndoe/", "roles": ["verified", "approved", "activated"], "primaryEmail": "johndoe@example.com" }, "error_code": null, "error_info": null } ``` ``` -------------------------------- ### Search Maniphest Tasks with Custom Ordering (cURL) Source: https://context7.com/phacility/phabricator/llms.txt This snippet demonstrates how to search for Maniphest tasks within specific projects and order them by priority. It requires an API token and specifies project constraints and the desired order. ```bash curl https://phabricator.example.com/api/maniphest.search \ -d api.token=api-tokenxxxxxx \ -d 'constraints[projects][0]=PHID-PROJ-backend' \ -d order=priority \ -d limit=25 ``` -------------------------------- ### PHP Basic Variable Assignment Source: https://github.com/phacility/phabricator/blob/master/src/infrastructure/markup/remarkup/__tests__/remarkup/quoted-code-block.txt Demonstrates a simple variable assignment in PHP. This snippet is a basic example and does not have external dependencies. It takes no input and produces no direct output other than the assigned variable. ```php Example

``` -------------------------------- ### Include Stripe PHP Bindings Source: https://github.com/phacility/phabricator/blob/master/externals/stripe-php/README.rdoc Demonstrates how to include the Stripe PHP bindings in your script, either by using Composer's autoloader or by manually requiring the Stripe.php file. ```php require_once('vendor/autoload.php'); ``` ```php require_once('/path/to/vendor/stripe/stripe-php/lib/Stripe.php'); ``` -------------------------------- ### File API - Upload Files Source: https://context7.com/phacility/phabricator/llms.txt The `file.upload` method uploads files to the Phabricator file storage. Files must be base64 encoded before upload. ```APIDOC ## POST /api/file.upload ### Description Uploads a file to Phabricator's storage. The file content must be provided as a base64-encoded string. You can optionally specify a view policy to control access. ### Method POST ### Endpoint https://phabricator.example.com/api/file.upload ### Parameters #### Query Parameters - **api_token** (string) - Required - Your API authentication token. - **name** (string) - Required - The desired filename for the uploaded file. - **data_base64** (string) - Required - The base64 encoded content of the file. - **viewPolicy** (string) - Optional - The PHID of the policy that governs who can view the file. Defaults to the global "public" policy. ### Request Example ```json { "api_token": "api-tokenxxxxxx", "name": "screenshot.png", "data_base64": "iVBORw0KGgoAAAANSUhEUgAA..." } ``` ### Response #### Success Response (200) - **result** (string) - The PHID of the newly uploaded file. #### Response Example ```json { "result": "PHID-FILE-abc123xyz", "error_code": null, "error_info": null } ``` ``` -------------------------------- ### Create Mailto Links using Remarkup Source: https://github.com/phacility/phabricator/blob/master/src/infrastructure/markup/remarkup/__tests__/remarkup/link-mailto.txt This snippet shows how to create clickable mailto links using Phabricator's Remarkup syntax. It includes variations with explicit link text and just the email address. No external dependencies are required for this syntax. ```markdown [[ mailto:alincoln@example.com | mail me ]] [ mail me ]( mailto:alincoln@example.com ) [[mailto:alincoln@example.com]] ``` -------------------------------- ### Stem a Word using Porter Stemmer (PHP) Source: https://github.com/phacility/phabricator/blob/master/externals/porter-stemmer/README.md Demonstrates how to use the Porter Stemmer class in PHP to stem a given word. This function takes a string as input and returns its stemmed form. Ensure the library is installed via Composer. ```php $stem = Porter::Stem($word); ``` -------------------------------- ### Publishing Octicons Source: https://github.com/phacility/phabricator/blob/master/externals/octicons/README.md Instructions for publishing a new version of Octicons to npm. ```APIDOC ## Publishing Octicons ### Description These are the steps required to publish a new version of Octicons to npm. If you do not have publishing access, please contact [#design-systems](https://github.slack.com/archives/design-systems). ### Steps 1. **Update Changelog:** Edit the `CHANGELOG.md` file to include the new version number and a summary of all changes made. 2. **Update Version:** Run `npm version ` (e.g., `npm version patch`, `npm version minor`, `npm version major`). Ensure you follow [semver](http://semver.org/) guidelines for versioning. 3. **Publish to npm:** Execute `npm publish` to upload the new version to npmjs.org. 4. **Push Changes:** Push all local changes and tags to the remote repository using `git push && git push --tags`. ``` -------------------------------- ### Project API - Search Projects Source: https://context7.com/phacility/phabricator/llms.txt The `project.search` method retrieves project information with filtering by name, slug, members, and other criteria. ```APIDOC ## GET /api/project.search ### Description Searches for projects based on various constraints and returns their details. Supports filtering by name, slugs, members, and includes optional attachments like members. ### Method GET ### Endpoint https://phabricator.example.com/api/project.search ### Parameters #### Query Parameters - **api_token** (string) - Required - Your API authentication token. - **constraints** (object) - Optional - Constraints to filter projects. - **query** (string) - Filters projects by name containing the query string. - **slugs** (array of strings) - Filters projects by their exact slugs. - **members** (array of strings) - Filters projects that include the specified member PHIDs. - **attachments** (object) - Optional - Specifies which attachments to include in the response. - **members** (integer) - Set to `1` to include member information. ### Request Example ```json { "api_token": "api-tokenxxxxxx", "constraints": { "query": "backend" }, "attachments": { "members": 1 } } ``` ### Response #### Success Response (200) - **result** (object) - Contains the list of matching projects and other metadata. - **data** (array of objects) - A list of project objects matching the search criteria. - **id** (integer) - The project's unique ID. - **type** (string) - The object type (e.g., "PROJ"). - **phid** (string) - The project's unique PHID. - **fields** (object) - Project field details (name, slug, description, icon, color, dates). - **attachments** (object) - Included attachments based on request. - **members** (object) - Information about project members. - **members** (array of objects) - List of member PHIDs. - **maps** (object) - Mappings for slugs. - **cursor** (object) - Pagination information. #### Response Example ```json { "result": { "data": [ { "id": 42, "type": "PROJ", "phid": "PHID-PROJ-backend123", "fields": { "name": "Backend Team", "slug": "backend_team", "description": {"raw": "Backend development and API work"}, "icon": {"key": "group", "name": "Group"}, "color": {"key": "blue", "name": "Blue"}, "dateCreated": 1612137600, "dateModified": 1612224000 }, "attachments": { "members": { "members": [ {"phid": "PHID-USER-dev1"}, {"phid": "PHID-USER-dev2"} ] } } } ], "maps": { "slugMap": { "backend_team": {"slug": "backend_team", "projectPHID": "PHID-PROJ-backend123"} } }, "cursor": {"limit": 100, "after": null, "before": null} }, "error_code": null, "error_info": null } ``` ```