Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
299b2af
Craft 6 compat
timkelty May 5, 2026
36c5fb7
Remove 99designs/http-signatures
timkelty May 6, 2026
739dbce
Remove legacy Yii dependencies
timkelty May 6, 2026
d3aa8f0
Fix remote Craft command PHP binary
timkelty May 6, 2026
7a89037
Composer
timkelty May 6, 2026
f52a6aa
Reset Cloud package for Craft 6 Laravel integration
timkelty May 7, 2026
0b9341e
Refresh Craft Cloud package for Craft 6
timkelty May 8, 2026
d9142cf
Remove test app key fixture
timkelty May 8, 2026
4ec2a28
Disable Craft plugin installer in CI
timkelty May 8, 2026
f61c31d
Add Husky pre-commit lint hook
timkelty May 8, 2026
7459575
Refresh Craft Cloud package for Craft 6 (#155)
timkelty May 8, 2026
c2acee0
Composer
timkelty May 10, 2026
7629732
Merge branch 'codex/craft-6-cloud-refresh' into 5.x
timkelty May 10, 2026
615dc29
Default logging
timkelty May 11, 2026
932b28b
Add Craft Cloud logging diagnostics
timkelty May 11, 2026
2907959
Configure Cloud logging during autoload
timkelty May 11, 2026
2be435d
Harden Cloud runtime log bootstrap
timkelty May 11, 2026
4e97fa4
Detect Cloud runtime from Lambda
timkelty May 11, 2026
9c63504
Remove Cloud autoload bootstrap
timkelty May 11, 2026
3ad7c7a
Restore Cloud init diagnostic
timkelty May 11, 2026
a02e17b
Log Cloud runtime diagnostics
timkelty May 12, 2026
64551f7
Log emergency path env diagnostic
timkelty May 12, 2026
70462fa
Log deployed config diagnostics
timkelty May 12, 2026
41a0ca9
Log storage path diagnostics
timkelty May 12, 2026
51bbb87
Set early log defaults on Cloud
timkelty May 12, 2026
512daaf
Remove early log env seeding
timkelty May 12, 2026
23fc6fe
Remove diagnostic logging
timkelty May 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .env.example

This file was deleted.

12 changes: 4 additions & 8 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@

/.gitattributes export-ignore
/.gitignore export-ignore
/.lintstagedrc.json export-ignore
/.prettierignore export-ignore
/.prettierrc.json export-ignore
/.releaserc.yaml export-ignore
/composer.lock export-ignore
/ecs.php export-ignore
/package.json export-ignore
/mago.toml export-ignore
/package-lock.json export-ignore
/phpstan.neon export-ignore
/webpack.config.js export-ignore
/package.json export-ignore
/phpunit.xml.dist export-ignore
/tests/ export-ignore
24 changes: 0 additions & 24 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

8 changes: 0 additions & 8 deletions .github/ISSUE_TEMPLATE/config.yml

This file was deleted.

66 changes: 24 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,48 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- 3.x
- 5.x
pull_request:
permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
code-quality:
name: Code Quality
uses: craftcms/.github/.github/workflows/code-quality.yml@v3
with:
node_version: '18'
php_version: '8.3'
jobs: '["ecs", "prettier"]'

compatibility:
name: Compatibility (Craft ${{ matrix.craft }})
jobs:
ci:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- craft: '^4.6'
flysystem: '^1.0'
- craft: '^5'
flysystem: '^2.0'
services:
mysql:
image: mysql:8.0
ports:
- 33066:3306
env:
MYSQL_DATABASE: db
MYSQL_USER: db
MYSQL_PASSWORD: db
MYSQL_ROOT_PASSWORD: root
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1 -udb -pdb"
--health-interval=10s
--health-timeout=5s
--health-retries=10
php: ['8.5']

steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: ${{ matrix.php }}
extensions: bcmath, curl, dom, intl, mbstring, pdo, zip
tools: composer:v2
coverage: none

- name: Resolve dependencies
run: composer update "craftcms/cms:${{ matrix.craft }}" "craftcms/flysystem:${{ matrix.flysystem }}" --with-all-dependencies --no-interaction --no-progress --prefer-dist --no-audit
- name: Validate Composer configuration
run: composer validate --strict

- name: Prepare test environment
run: composer test:init
- name: Install dependencies
uses: ramsey/composer-install@v3

- name: Run PHPStan
run: composer phpstan
- name: Run linter
run: composer lint

- name: Run unit tests
- name: Run tests
run: composer test
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
vendor
.env
tests/_output
tests/.env
tests/_support/_generated
/vendor/
/node_modules/
/.env
/.phpunit.cache/
3 changes: 1 addition & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
npx lint-staged
composer run phpstan analyse
composer lint
4 changes: 0 additions & 4 deletions .lintstagedrc.json

This file was deleted.

6 changes: 0 additions & 6 deletions .prettierignore

This file was deleted.

5 changes: 0 additions & 5 deletions .prettierrc.json

This file was deleted.

4 changes: 1 addition & 3 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
branches:
- main
- '1.x'
- '2.x'
- '5.x'
tagFormat: '${version}'
plugins:
- '@semantic-release/commit-analyzer'
Expand Down
121 changes: 2 additions & 119 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,120 +1,3 @@
<a href="https://craftcms.com/cloud" rel="noopener" target="_blank" title="Craft Cloud"><img src="https://raw.githubusercontent.com/craftcms/.github/v3/profile/product-icons/craft-cloud.svg" alt="Craft Cloud icon" width="65"></a>
# Craft Cloud Package

# Craft Cloud Extension

Welcome to [**Craft Cloud**](https://craftcms.com/cloud)!

This repository contains source code for the `craftcms/cloud` Composer package, which is required to run a Craft project on our first-party hosting platform, Craft Cloud.

When installed, the extension automatically [bootstraps](https://www.yiiframework.com/doc/guide/2.0/en/runtime-bootstrapping) itself and makes necessary [application configuration](https://craftcms.com/docs/5.x/reference/config/app.html) changes for the detected environment:

- :cloud_with_lightning: **Cloud:** There’s no infrastructure settings to worry about—database, queue, cache, and session configuration is handled for you.
- :computer: **Local development:** Craft runs normally, in your favorite [development environment](https://craftcms.com/docs/5.x/install.html).

:sparkles: To learn more about Cloud, check out [our website](https://craftcms.com/cloud)—or dive right in with [Craft Console](https://console.craftcms.com/cloud). Interested in everything the extension does to get your app ready for Cloud? Read our [Cloud extension deep-dive](https://craftcms.com/knowledge-base/cloud-extension), in the knowledge base.

## Installation

The Cloud extension can be installed in any existing Craft 4.6+ project by running `php craft setup/cloud`. Craft will add the `craftcms/cloud` package and run the extension’s own setup wizard.

> [!TIP]
> This process includes the creation of a [`craft-cloud.yaml` configuration file](https://craftcms.com/knowledge-base/cloud-config) which helps Cloud understand your project’s structure and determines which versions of PHP and Node your project will use during builds and at runtime.

When you [deploy](https://craftcms.com/knowledge-base/cloud-deployment) a project to Cloud, the `cloud/up` command will run, wrapping Craft’s built-in [`up` command](https://craftcms.com/docs/5.x/reference/cli.html#up) and adding the cache and session tables (if they’re not already present).

## Filesystem

When setting up your project’s assets, use the provided **Craft Cloud** filesystem type. Read more about [managing assets in Cloud projects](https://craftcms.com/knowledge-base/cloud-assets).

## Testing

The Codeception `unit` suite on `3.x` boots Craft and expects a local test database.

```bash
composer test:init
composer test:up
composer test
composer test:down
```

`composer test:init` will create `tests/.env` from `tests/.env.example` if it does not already exist. `composer test:up` uses that file when starting the MySQL service defined in `tests/docker-compose.yaml`.

For local compatibility work on `3.x`, it can be helpful to keep your main checkout on the default/latest Craft 5 dependency set and use a separate Git worktree for Craft 4 so each checkout can keep its own `vendor/`, `composer.lock`, and `tests/.env` state.

```bash
git worktree add ../cloud-3x-craft4 3.x

# In the Craft 4 worktree:
composer update "craftcms/cms:^4.6" "craftcms/flysystem:^1.0" --with-all-dependencies --no-audit

# In your main checkout:
composer update "craftcms/cms:^5" "craftcms/flysystem:^2.0" --with-all-dependencies
```

## Developer Features

### Template Helpers

#### `cloud.artifactUrl()`

Generates a URL to a resource that was uploaded to the CDN during the build and deployment process.

```twig
{# Output a script tag with a build-specific URL: #}
<script src="{{ cloud.artifactUrl('dist/js/app.js') }}"></script>

{# You can also use the extension-provided alias: #}
{% js '@artifactBaseUrl/dist/js/app.js' %}
```

Read more about [how to use artifact URLs](https://craftcms.com/knowledge-base/cloud-builds#artifact-uRLs).

#### `cloud.isCraftCloud`

`true` when the app detects it is running on Cloud infrastructure, `false` otherwise.

```twig
{% if cloud.isCraftCloud %}
Welcome to Cloud!
{% endif %}
```

### Aliases

The following aliases are available, in addition to [those provided by Craft](https://craftcms.com/docs/5.x/configure.html#aliases).

#### `@web`

On Cloud, the `@web` alias is guaranteed to be the correct environment URL for each HTTP context, whether that be a [preview domain](https://craftcms.com/knowledge-base/cloud-domains#preview-domains) or [custom domain](https://craftcms.com/knowledge-base/cloud-domains#adding-a-domain).

#### `@artifactBaseUrl`

Equivalent to [`cloud.artifactUrl()`](#artifactUrl), this allows [Project Config](https://craftcms.com/docs/5.x/system/project-config.html) settings to take advantage of dynamic, build-specific CDN URLs.

## Configuration

Most configuration (to Craft and the extension itself) is handled directly by Cloud infrastructure, through [environment overrides](https://craftcms.com/docs/5.x/configure.html#environment-overrides). These options are provided strictly for reference, and have limited utility outside the platform.

| Option | Type | Description |
|-----------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------|
| `artifactBaseUrl` | `string\|null` | Directly set a fully-qualified URL to build artifacts. |
| `s3ClientOptions` | `array` | Additional settings to pass to the `Aws\S3\S3Client` instance when accessing storage APIs. |
| `cdnBaseUrl` | `string` | Used when building URLs to [assets](#filesystem) and other build [artifacts](#artifacturl). |
| `sqsUrl` | `string` | Determines how Craft communicates with the underlying queue provider. |
| `projectId` | `string` | UUID of the current project. |
| `environmentId` | `string` | UUID of the current [environment](https://craftcms.com/knowledge-base/cloud-environments). |
| `buildId` | `string` | UUID of the current [build](https://craftcms.com/knowledge-base/cloud-builds). |
| `accessKey` | `string` | AWS access key, used for communicating with storage APIs. |
| `accessSecret` | `string` | AWS access secret, used in conjunction with the `accessKey`. |
| `accessToken` | `string` | AWS access token. |
| `redisUrl` | `string` | Connection string for the environment’s Redis instance. |
| `signingKey` | `string` | A secret value used to protect transform URLs against abuse. |
| `useAssetBundleCdn` | `boolean` | Whether or not to enable the CDN for asset bundles. |
| `previewDomain` | `string\|null` | Set when accessing an environment from its [preview domain](https://craftcms.com/knowledge-base/cloud-domains#preview-domains). |
| `useQueue` | `boolean` | Whether or not to use Cloud’s SQS-backed queue driver. |
| `region` | `string` | The app region, chosen when creating the project. |
| `useAssetCdn` | `boolean` | Whether or not to enable the CDN for uploaded assets. |
| `useArtifactCdn` | `boolean` | Whether or not to enable the CDN for build artifacts and asset bundles. |
| `staticCacheDuration` | `int` | The default duration, in seconds, to statically cache requests. |
> [!TIP]
> These options can also be set via environment overrides beginning with `CRAFT_CLOUD_`.
Run Craft CMS on Craft Cloud.
8 changes: 0 additions & 8 deletions autoload.php

This file was deleted.

21 changes: 0 additions & 21 deletions codeception.yml

This file was deleted.

Loading
Loading