From fb382b0586c7511bae861c439daf9e0b405b1f46 Mon Sep 17 00:00:00 2001 From: Rayiumir Date: Thu, 29 Oct 2026 18:40:54 +0330 Subject: [PATCH 1/2] feat: track post views once per session Display view counts on posts and count each post once per browser session. --- app/Actions/RecordCommitView.php | 24 + app/Http/Controllers/CommitController.php | 5 +- app/Http/Resources/CommitResource.php | 8 +- app/Models/Commit.php | 3 + app/Queries/CommitBuilder.php | 1 + composer.json | 2 + composer.lock | 1378 +++++++++++++++-- config/octane.php | 254 +++ ...43753_add_views_count_to_commits_table.php | 24 + resources/js/components/commit-card.tsx | 21 +- resources/js/types/commit.ts | 1 + .../Controllers/Api/CommitControllerTest.php | 3 + .../Controllers/CommitControllerTest.php | 14 + tests/Unit/CommitImages.test.tsx | 1 + tests/Unit/NotificationInbox.test.tsx | 1 + 15 files changed, 1640 insertions(+), 100 deletions(-) create mode 100644 app/Actions/RecordCommitView.php create mode 100644 config/octane.php create mode 100644 database/migrations/2026_10_29_143753_add_views_count_to_commits_table.php diff --git a/app/Actions/RecordCommitView.php b/app/Actions/RecordCommitView.php new file mode 100644 index 0000000000..f9e69959d9 --- /dev/null +++ b/app/Actions/RecordCommitView.php @@ -0,0 +1,24 @@ +id}"; + + if ($session->has($key)) { + return; + } + + $session->put($key, true); + + Commit::withoutTimestamps(fn () => $commit->increment('views_count')); + } +} diff --git a/app/Http/Controllers/CommitController.php b/app/Http/Controllers/CommitController.php index b6ad709bc7..21c11f414d 100644 --- a/app/Http/Controllers/CommitController.php +++ b/app/Http/Controllers/CommitController.php @@ -6,6 +6,7 @@ use App\Actions\CreateCommit; use App\Actions\DeleteCommit; +use App\Actions\RecordCommitView; use App\Dto\ThreadContinuation; use App\Enums\CommitStatus; use App\Http\Requests\CreateCommitRequest; @@ -32,8 +33,10 @@ /** * Commits are public, so guests and crawlers read the same page, with the commit's link preview and the replies shown under it as structured data. */ - public function show(ShowCommitRequest $request, #[CurrentUser] ?User $currentUser, User $user, Commit $commit, CommitPageQuery $page, CommitAncestorsQuery $ancestors, CommitContinuationQuery $continuation, CommitRepliesQuery $replies, PageMetadata $metadata): Response + public function show(ShowCommitRequest $request, #[CurrentUser] ?User $currentUser, User $user, Commit $commit, RecordCommitView $recordView, CommitPageQuery $page, CommitAncestorsQuery $ancestors, CommitContinuationQuery $continuation, CommitRepliesQuery $replies, PageMetadata $metadata): Response { + $recordView->handle($commit, $request->session()); + $focusedCommit = null; $getCommit = function () use (&$focusedCommit, $page, $commit, $currentUser): Commit { return $focusedCommit ??= $page->get($commit, $currentUser); diff --git a/app/Http/Resources/CommitResource.php b/app/Http/Resources/CommitResource.php index 6ce3b53b2d..c2490bd027 100644 --- a/app/Http/Resources/CommitResource.php +++ b/app/Http/Resources/CommitResource.php @@ -25,9 +25,10 @@ * it also has preview_segments, the excerpt a list shows of a long commit, the poll, with what the user may see of * its votes, and the commit it quotes, or null once the user may no longer see that one, while quoted_commit_id still * says it quoted something. In a list, reply_preview is the newest reply or quote the web shows under it. As on the - * web, the counts, link_preview, images, starred, parent, poll, quoted_commit and reply_preview are only - * there when they were loaded, so ancestors and the commits of notifications come without some of them. The images of - * a commit that isn't published yet have temporary URLs, since the app has no web session to load them with. + * web, the star and reply counts, link_preview, images, starred, parent, poll, quoted_commit and reply_preview are only + * there when they were loaded, so ancestors and the commits of notifications come without some of them. The view count + * is always included. The images of a commit that isn't published yet have temporary URLs, since the app has no web + * session to load them with. * * A deleted commit that still has replies stays in its thread as a tombstone: its id, parent_id, deleted_at and * replies_count, but never its author or body. Only signed requests are ever sent one. @@ -61,6 +62,7 @@ public function toArray(Request $request): array 'created_at' => $this->created_at->toIso8601ZuluString(), 'stars_count' => $this->whenCounted('stars'), 'replies_count' => $this->whenCounted('replies'), + 'views_count' => $this->views_count, 'link_preview' => $this->whenLoaded('linkPreview'), 'images' => $this->whenLoaded('images', fn (): mixed => $this->status === CommitStatus::Approved || ! $this->imagesAreVisibleTo($request->user()) ? $this->images diff --git a/app/Models/Commit.php b/app/Models/Commit.php index 5e0da8e6e3..20c60fbb4c 100644 --- a/app/Models/Commit.php +++ b/app/Models/Commit.php @@ -41,6 +41,7 @@ * @property-read CarbonInterface|null $deleted_at * @property-read int $stars_count * @property-read int $pasteis_count + * @property-read int $views_count * @property-read bool $starred * @property-read User|null $user * @property-read Collection $stars @@ -93,6 +94,7 @@ final class Commit extends Model */ protected $attributes = [ 'pasteis_count' => 0, + 'views_count' => 0, ]; /** @@ -112,6 +114,7 @@ public function casts(): array 'root_id' => 'string', 'hot_score' => 'float', 'pasteis_count' => 'integer', + 'views_count' => 'integer', 'body' => 'string', 'mentions' => 'array', 'status' => CommitStatus::class, diff --git a/app/Queries/CommitBuilder.php b/app/Queries/CommitBuilder.php index 4243256ec3..bb1f3358c9 100644 --- a/app/Queries/CommitBuilder.php +++ b/app/Queries/CommitBuilder.php @@ -28,6 +28,7 @@ final class CommitBuilder extends Builder private const array COLUMNS_BUT_EMBEDDING = [ 'id', 'user_id', 'body', 'created_at', 'updated_at', 'status', 'parent_id', 'deleted_at', 'link_preview_id', 'quoted_commit_id', 'mentions', 'ai_decision', 'ai_categories', 'root_id', 'hot_score', 'pasteis_count', + 'views_count', ]; /** diff --git a/composer.json b/composer.json index 3e7359a79f..7269b13e0a 100644 --- a/composer.json +++ b/composer.json @@ -23,6 +23,8 @@ "nunomaduro/essentials": "^1.2.0", "phpseclib/phpseclib": "^4.0.2", "resend/resend-php": "^1.17", + "spiral/roadrunner-cli": "^2.7.2", + "spiral/roadrunner-http": "^3.6.0", "symfony/html-sanitizer": "^8.1.8", "tempest/highlight": "^2.29.0" }, diff --git a/composer.lock b/composer.lock index babf34e99c..a401cee019 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b8ed9e74c0be3d2aa2e7cbcf2a60a8a8", + "content-hash": "418d8070a1bf087dfaba892f5890ad46", "packages": [ { "name": "aws/aws-crt-php", @@ -291,6 +291,83 @@ ], "time": "2026-09-06T14:11:38+00:00" }, + { + "name": "composer/semver", + "version": "3.5.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "9dfce66f1e97360ea5e6d3e38ab14277e4cc591e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/9dfce66f1e97360ea5e6d3e38ab14277e4cc591e", + "reference": "9dfce66f1e97360ea5e6d3e38ab14277e4cc591e", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Version comparison library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.5.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + } + ], + "time": "2026-10-22T15:37:26+00:00" + }, { "name": "dflydev/dot-access-data", "version": "v3.0.3", @@ -807,6 +884,50 @@ ], "time": "2025-12-03T09:33:47+00:00" }, + { + "name": "google/protobuf", + "version": "v5.36.2", + "source": { + "type": "git", + "url": "https://github.com/protocolbuffers/protobuf-php.git", + "reference": "020bc8e831611869ac387ddd38fbbadd78d15195" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/020bc8e831611869ac387ddd38fbbadd78d15195", + "reference": "020bc8e831611869ac387ddd38fbbadd78d15195", + "shasum": "" + }, + "require": { + "php": ">=8.2.0" + }, + "require-dev": { + "phpunit/phpunit": ">=11.5.50 <12.0.0" + }, + "suggest": { + "ext-bcmath": "Need to support JSON deserialization" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Protobuf\\": "src/Google/Protobuf", + "GPBMetadata\\Google\\Protobuf\\": "src/GPBMetadata/Google/Protobuf" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "proto library for PHP", + "homepage": "https://developers.google.com/protocol-buffers/", + "keywords": [ + "proto" + ], + "support": { + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v5.36.2" + }, + "time": "2026-09-17T15:56:42+00:00" + }, { "name": "graham-campbell/result-type", "version": "v1.2.0", @@ -4714,7 +4835,961 @@ "src/Resend.php" ], "psr-4": { - "Resend\\": "src/" + "Resend\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Resend and contributors", + "homepage": "https://github.com/resend/resend-php/contributors" + } + ], + "description": "Resend PHP library.", + "homepage": "https://resend.com/", + "keywords": [ + "api", + "client", + "php", + "resend", + "sdk" + ], + "support": { + "issues": "https://github.com/resend/resend-php/issues", + "source": "https://github.com/resend/resend-php/tree/v1.17.0" + }, + "time": "2026-10-20T03:25:21+00:00" + }, + { + "name": "roadrunner-php/roadrunner-api-dto", + "version": "v1.18.0", + "source": { + "type": "git", + "url": "https://github.com/roadrunner-php/roadrunner-api-dto.git", + "reference": "81d8247894cd3f75a4e0fba2b619f9d7efa03d27" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/roadrunner-php/roadrunner-api-dto/zipball/81d8247894cd3f75a4e0fba2b619f9d7efa03d27", + "reference": "81d8247894cd3f75a4e0fba2b619f9d7efa03d27", + "shasum": "" + }, + "require": { + "google/protobuf": "^4.31.1||^5.34.0", + "php": "^8.1" + }, + "conflict": { + "temporal/sdk": "<2.9.0" + }, + "suggest": { + "google/common-protos": "Required for Temporal API" + }, + "type": "library", + "autoload": { + "psr-4": { + "Temporal\\": "generated/Temporal", + "RoadRunner\\": "generated/RoadRunner", + "GPBMetadata\\": "generated/GPBMetadata" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Pavel Butchnev (butschster)", + "email": "pavel.buchnev@spiralscout.com" + }, + { + "name": "Aleksei Gagarin (roxblnfk)", + "email": "alexey.gagarin@spiralscout.com" + }, + { + "name": "RoadRunner Community", + "homepage": "https://github.com/roadrunner-server/roadrunner/graphs/contributors" + } + ], + "description": "RoadRunner PHP API", + "homepage": "https://roadrunner.dev", + "support": { + "chat": "https://discord.gg/V6EK4he", + "docs": "https://docs.roadrunner.dev", + "forum": "https://forum.roadrunner.dev", + "issues": "https://github.com/roadrunner-server/roadrunner/issues", + "source": "https://github.com/roadrunner-php/roadrunner-api-dto/tree/v1.18.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/roadrunner-server", + "type": "github" + } + ], + "time": "2026-10-09T15:32:54+00:00" + }, + { + "name": "roadrunner/goridge", + "version": "4.6.0", + "source": { + "type": "git", + "url": "https://github.com/roadrunner-php/goridge.git", + "reference": "887bd3a6f89a0b95252db608856d33d7a1284406" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/roadrunner-php/goridge/zipball/887bd3a6f89a0b95252db608856d33d7a1284406", + "reference": "887bd3a6f89a0b95252db608856d33d7a1284406", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-sockets": "*", + "php": ">=8.2", + "roadrunner/roadrunner": "^3.0" + }, + "replace": { + "spiral/goridge": "self.version" + }, + "require-dev": { + "google/protobuf": "^3.22 || ^4.0 || ^5.0", + "jetbrains/phpstorm-attributes": "^1.0", + "llm/skills": "^1.14", + "roxblnfk/unpoly": "^1.8", + "rybakit/msgpack": "^0.7", + "spiral/code-style": "^2.3.1", + "testo/testo": "^0.10.55", + "vimeo/psalm": "^6 || ^7" + }, + "suggest": { + "ext-protobuf": "Protobuf codec support", + "google/protobuf": "(^3.22 || ^4.0 || ^5.0) Protobuf codec support" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spiral\\Goridge\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Titov", + "homepage": "https://github.com/wolfy-j" + }, + { + "name": "Valery Piashchynski", + "homepage": "https://github.com/rustatian" + }, + { + "name": "Aleksei Gagarin", + "homepage": "https://github.com/roxblnfk" + }, + { + "name": "Pavel Buchnev", + "homepage": "https://github.com/butschster" + }, + { + "name": "Maksim Smakouz", + "homepage": "https://github.com/msmakouz" + }, + { + "name": "RoadRunner Community", + "homepage": "https://github.com/roadrunner-server/roadrunner/graphs/contributors" + } + ], + "description": "High-performance PHP-to-Go IPC bridge: the RPC transport between PHP workers and the RoadRunner application server", + "homepage": "https://roadrunner.dev/", + "keywords": [ + "Relay", + "Socket", + "golang", + "goridge", + "ipc", + "pipes", + "protobuf", + "roadrunner", + "rpc" + ], + "support": { + "chat": "https://discord.gg/V6EK4he", + "docs": "https://docs.roadrunner.dev/docs/php-worker/rpc", + "issues": "https://github.com/roadrunner-server/roadrunner/issues", + "source": "https://github.com/roadrunner-php/goridge" + }, + "funding": [ + { + "url": "https://github.com/sponsors/roadrunner-server", + "type": "github" + } + ], + "time": "2026-10-19T08:41:25+00:00" + }, + { + "name": "roadrunner/roadrunner", + "version": "v3.0.1", + "source": { + "type": "git", + "url": "https://github.com/roadrunner-server/roadrunner.git", + "reference": "ed89c2ec991f64b072297fcbee5ad7f058779199" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/roadrunner-server/roadrunner/zipball/ed89c2ec991f64b072297fcbee5ad7f058779199", + "reference": "ed89c2ec991f64b072297fcbee5ad7f058779199", + "shasum": "" + }, + "type": "metapackage", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Titov / Wolfy-J", + "email": "wolfy.jd@gmail.com" + }, + { + "name": "Valery Piashchynski", + "homepage": "https://github.com/rustatian" + }, + { + "name": "RoadRunner Community", + "homepage": "https://github.com/roadrunner-server/roadrunner/graphs/contributors" + } + ], + "description": "RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins", + "homepage": "https://roadrunner.dev/", + "support": { + "chat": "https://discord.gg/V6EK4he", + "docs": "https://docs.roadrunner.dev/", + "issues": "https://github.com/roadrunner-server/roadrunner/issues", + "source": "https://github.com/roadrunner-server/roadrunner/tree/v3.0.1" + }, + "funding": [ + { + "url": "https://github.com/sponsors/roadrunner-server", + "type": "github" + } + ], + "time": "2026-10-21T19:33:12+00:00" + }, + { + "name": "spiral/core", + "version": "3.17.2", + "source": { + "type": "git", + "url": "https://github.com/spiral/core.git", + "reference": "ca5b8483610aed0c82d4f06bc7907e191d88aca0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spiral/core/zipball/ca5b8483610aed0c82d4f06bc7907e191d88aca0", + "reference": "ca5b8483610aed0c82d4f06bc7907e191d88aca0", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "spiral/security": "^3.17.2" + }, + "provide": { + "psr/container-implementation": "^1.1|^2.0" + }, + "require-dev": { + "mockery/mockery": "^1.6.12", + "phpunit/phpunit": "^10.5.41", + "vimeo/psalm": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.17.x-dev" + } + }, + "autoload": { + "psr-4": { + "Spiral\\Core\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Titov (wolfy-j)", + "email": "wolfy-j@spiralscout.com" + }, + { + "name": "Pavel Butchnev (butschster)", + "homepage": "https://github.com/butschster" + }, + { + "name": "Aleksei Gagarin (roxblnfk)", + "homepage": "https://github.com/roxblnfk" + }, + { + "name": "Maksim Smakouz (msmakouz)", + "email": "maksim.smakouz@spiralscout.com" + } + ], + "description": "IoC container, IoC scopes, factory, memory, configuration interfaces", + "homepage": "https://spiral.dev", + "support": { + "issues": "https://github.com/spiral/framework/issues", + "source": "https://github.com/spiral/core" + }, + "funding": [ + { + "url": "https://github.com/sponsors/spiral", + "type": "github" + } + ], + "time": "2026-08-05T12:07:26+00:00" + }, + { + "name": "spiral/hmvc", + "version": "3.17.2", + "source": { + "type": "git", + "url": "https://github.com/spiral/hmvc.git", + "reference": "11111aac577f3d7ccc9bbe8b79dc6441fd21b9c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spiral/hmvc/zipball/11111aac577f3d7ccc9bbe8b79dc6441fd21b9c5", + "reference": "11111aac577f3d7ccc9bbe8b79dc6441fd21b9c5", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/event-dispatcher": "^1.0", + "spiral/core": "^3.17.2", + "spiral/interceptors": "^3.17.2" + }, + "require-dev": { + "phpunit/phpunit": "^10.5.41", + "spiral/testing": "^2.12", + "vimeo/psalm": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.17.x-dev" + } + }, + "autoload": { + "psr-4": { + "Spiral\\Core\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Titov (wolfy-j)", + "email": "wolfy-j@spiralscout.com" + }, + { + "name": "Pavel Butchnev (butschster)", + "homepage": "https://github.com/butschster" + }, + { + "name": "Aleksei Gagarin (roxblnfk)", + "homepage": "https://github.com/roxblnfk" + }, + { + "name": "Maksim Smakouz (msmakouz)", + "email": "maksim.smakouz@spiralscout.com" + } + ], + "description": "HMVC Core and Controllers", + "homepage": "https://spiral.dev", + "support": { + "chat": "https://discord.gg/V6EK4he", + "docs": "https://spiral.dev/docs", + "issues": "https://github.com/spiral/framework/issues", + "source": "https://github.com/spiral/hmvc" + }, + "funding": [ + { + "url": "https://github.com/sponsors/spiral", + "type": "github" + } + ], + "time": "2026-08-05T12:00:27+00:00" + }, + { + "name": "spiral/interceptors", + "version": "3.17.2", + "source": { + "type": "git", + "url": "https://github.com/spiral/interceptors.git", + "reference": "ea0e10ecb2c6058541a2b097a660fd2b532a5ffa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spiral/interceptors/zipball/ea0e10ecb2c6058541a2b097a660fd2b532a5ffa", + "reference": "ea0e10ecb2c6058541a2b097a660fd2b532a5ffa", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/event-dispatcher": "^1.0", + "spiral/core": "^3.17.2" + }, + "require-dev": { + "phpunit/phpunit": "^10.5.41", + "spiral/testing": "^2.12", + "vimeo/psalm": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.17.x-dev" + } + }, + "autoload": { + "psr-4": { + "Spiral\\Interceptors\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Titov (wolfy-j)", + "email": "wolfy-j@spiralscout.com" + }, + { + "name": "Pavel Butchnev (butschster)", + "homepage": "https://github.com/butschster" + }, + { + "name": "Aleksei Gagarin (roxblnfk)", + "homepage": "https://github.com/roxblnfk" + }, + { + "name": "Maksim Smakouz (msmakouz)", + "email": "maksim.smakouz@spiralscout.com" + } + ], + "description": "Spiral Interceptors", + "homepage": "https://spiral.dev", + "keywords": [ + "aop", + "interceptors", + "spiral" + ], + "support": { + "chat": "https://discord.gg/V6EK4he", + "docs": "https://spiral.dev/docs", + "issues": "https://github.com/spiral/framework/issues", + "source": "https://github.com/spiral/interceptors" + }, + "funding": [ + { + "url": "https://github.com/sponsors/spiral", + "type": "github" + } + ], + "time": "2026-08-05T12:00:37+00:00" + }, + { + "name": "spiral/logger", + "version": "3.17.2", + "source": { + "type": "git", + "url": "https://github.com/spiral/logger.git", + "reference": "671d91a3427019a14670b614474cc57156d5cd69" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spiral/logger/zipball/671d91a3427019a14670b614474cc57156d5cd69", + "reference": "671d91a3427019a14670b614474cc57156d5cd69", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/log": "1 - 3", + "spiral/core": "^3.17.2" + }, + "require-dev": { + "mockery/mockery": "^1.6.12", + "phpunit/phpunit": "^10.5.41", + "vimeo/psalm": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.17.x-dev" + } + }, + "autoload": { + "psr-4": { + "Spiral\\Logger\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Titov (wolfy-j)", + "email": "wolfy-j@spiralscout.com" + }, + { + "name": "Pavel Butchnev (butschster)", + "homepage": "https://github.com/butschster" + }, + { + "name": "Aleksei Gagarin (roxblnfk)", + "homepage": "https://github.com/roxblnfk" + }, + { + "name": "Maksim Smakouz (msmakouz)", + "email": "maksim.smakouz@spiralscout.com" + } + ], + "description": "LogFactory and global log listeners", + "homepage": "https://spiral.dev", + "support": { + "issues": "https://github.com/spiral/framework/issues", + "source": "https://github.com/spiral/logger" + }, + "funding": [ + { + "url": "https://github.com/sponsors/spiral", + "type": "github" + } + ], + "time": "2026-08-05T12:05:38+00:00" + }, + { + "name": "spiral/roadrunner", + "version": "v2025.1.15", + "source": { + "type": "git", + "url": "https://github.com/roadrunner-server/roadrunner.git", + "reference": "321b817fab1056e404533ca1ddd200e77d1525fd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/roadrunner-server/roadrunner/zipball/321b817fab1056e404533ca1ddd200e77d1525fd", + "reference": "321b817fab1056e404533ca1ddd200e77d1525fd", + "shasum": "" + }, + "type": "metapackage", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Titov / Wolfy-J", + "email": "wolfy.jd@gmail.com" + }, + { + "name": "Valery Piashchynski", + "homepage": "https://github.com/rustatian" + }, + { + "name": "RoadRunner Community", + "homepage": "https://github.com/roadrunner-server/roadrunner/graphs/contributors" + } + ], + "description": "RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins", + "homepage": "https://roadrunner.dev/", + "support": { + "chat": "https://discord.gg/V6EK4he", + "docs": "https://docs.roadrunner.dev/", + "issues": "https://github.com/roadrunner-server/roadrunner/issues", + "source": "https://github.com/roadrunner-server/roadrunner/tree/v2025.1.15" + }, + "funding": [ + { + "url": "https://github.com/sponsors/roadrunner-server", + "type": "github" + } + ], + "time": "2026-06-17T14:49:38+00:00" + }, + { + "name": "spiral/roadrunner-cli", + "version": "v2.7.2", + "source": { + "type": "git", + "url": "https://github.com/roadrunner-php/cli.git", + "reference": "54909d3fff22d34d1a6e894785f3df9dca0e2e8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/roadrunner-php/cli/zipball/54909d3fff22d34d1a6e894785f3df9dca0e2e8c", + "reference": "54909d3fff22d34d1a6e894785f3df9dca0e2e8c", + "shasum": "" + }, + "require": { + "composer/semver": "^3.4", + "ext-json": "*", + "php": ">=8.1", + "spiral/roadrunner-worker": "^2 || ^3", + "spiral/tokenizer": "^2.13 || ^3.15", + "symfony/console": "^5.3 || ^6.0 || ^7.0 || ^8.0", + "symfony/http-client": "^4.4.51 || ^5.4.49 || ^6.4.17 || ^7.2 || ^8.0", + "symfony/yaml": "^5.4.49 || ^6.4.17 || ^7.2 || ^8.0" + }, + "require-dev": { + "jetbrains/phpstorm-attributes": "^1.2", + "spiral/code-style": "^2.2.2", + "spiral/dumper": "^3.3", + "vimeo/psalm": "^6.0" + }, + "bin": [ + "bin/rr" + ], + "type": "library", + "autoload": { + "psr-4": { + "Spiral\\RoadRunner\\Console\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Titov (wolfy-j)", + "email": "wolfy-j@spiralscout.com" + }, + { + "name": "RoadRunner Community", + "homepage": "https://github.com/spiral/roadrunner/graphs/contributors" + } + ], + "description": "RoadRunner: Command Line Interface", + "homepage": "https://roadrunner.dev", + "support": { + "chat": "https://discord.gg/V6EK4he", + "docs": "https://docs.roadrunner.dev", + "issues": "https://github.com/roadrunner-server/roadrunner/issues", + "source": "https://github.com/roadrunner-php/cli/tree/v2.7.2" + }, + "funding": [ + { + "url": "https://github.com/sponsors/roadrunner-server", + "type": "github" + } + ], + "time": "2025-12-14T19:18:46+00:00" + }, + { + "name": "spiral/roadrunner-http", + "version": "v3.6.0", + "source": { + "type": "git", + "url": "https://github.com/roadrunner-php/http.git", + "reference": "a44a5f7d54d4ee8a14fe99cd22dcd128db270c88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/roadrunner-php/http/zipball/a44a5f7d54d4ee8a14fe99cd22dcd128db270c88", + "reference": "a44a5f7d54d4ee8a14fe99cd22dcd128db270c88", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=8.1", + "psr/http-factory": "^1.0.1", + "psr/http-message": "^1.0.1 || ^2.0", + "roadrunner-php/roadrunner-api-dto": "^1.6", + "spiral/roadrunner": "^2023.3 || ^2024.1 || ^2025.1", + "spiral/roadrunner-worker": "^3.5", + "symfony/polyfill-php83": "^1.29" + }, + "require-dev": { + "jetbrains/phpstorm-attributes": "^1.0", + "nyholm/psr7": "^1.3", + "phpunit/phpunit": "^10.5", + "spiral/code-style": "^2.3", + "spiral/dumper": "^3.3", + "symfony/process": "^6.2 || ^7.0", + "vimeo/psalm": "^6.13" + }, + "suggest": { + "ext-protobuf": "Provides Protocol Buffers support. Without it, performance will be lower.", + "spiral/roadrunner-cli": "Provides RoadRunner installation and management CLI tools" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spiral\\RoadRunner\\Http\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Titov (wolfy-j)", + "email": "wolfy-j@spiralscout.com" + }, + { + "name": "Valery Piashchynski", + "homepage": "https://github.com/rustatian" + }, + { + "name": "Aleksei Gagarin (roxblnfk)", + "homepage": "https://github.com/roxblnfk" + }, + { + "name": "Pavel Buchnev (butschster)", + "email": "pavel.buchnev@spiralscout.com" + }, + { + "name": "Maksim Smakouz (msmakouz)", + "email": "maksim.smakouz@spiralscout.com" + }, + { + "name": "RoadRunner Community", + "homepage": "https://github.com/roadrunner-server/roadrunner/graphs/contributors" + } + ], + "description": "RoadRunner: HTTP and PSR-7 worker", + "homepage": "https://spiral.dev/", + "support": { + "chat": "https://discord.gg/V6EK4he", + "docs": "https://docs.roadrunner.dev", + "forum": "https://forum.roadrunner.dev/", + "issues": "https://github.com/roadrunner-server/roadrunner/issues", + "source": "https://github.com/roadrunner-php/http/tree/v3.6.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/roadrunner-server", + "type": "github" + } + ], + "time": "2025-08-31T12:42:23+00:00" + }, + { + "name": "spiral/roadrunner-worker", + "version": "v3.8.2", + "source": { + "type": "git", + "url": "https://github.com/roadrunner-php/worker.git", + "reference": "35fcf09b55de68954e03dc727b710b963db9517d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/roadrunner-php/worker/zipball/35fcf09b55de68954e03dc727b710b963db9517d", + "reference": "35fcf09b55de68954e03dc727b710b963db9517d", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2.0", + "ext-json": "*", + "ext-sockets": "*", + "php": ">=8.2", + "psr/log": "^2.0 || ^3.0", + "roadrunner/goridge": "^4.5", + "roadrunner/roadrunner": "^3.0" + }, + "require-dev": { + "buggregator/trap": "^1.13", + "jetbrains/phpstorm-attributes": "^1.0", + "llm/skills": "^1.14", + "mockery/mockery": "^1.6.7", + "roxblnfk/unpoly": "^1.8", + "spiral/code-style": "^2.3.1", + "testo/bridge-mockery": "^0.1.2", + "testo/testo": "^0.10.55", + "vimeo/psalm": "^6 || ^7" + }, + "suggest": { + "roadrunner/cli": "Provides RoadRunner installation and management CLI tools" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spiral\\RoadRunner\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Titov", + "homepage": "https://github.com/wolfy-j" + }, + { + "name": "Valery Piashchynski", + "homepage": "https://github.com/rustatian" + }, + { + "name": "Aleksei Gagarin", + "homepage": "https://github.com/roxblnfk" + }, + { + "name": "Pavel Buchnev", + "homepage": "https://github.com/butschster" + }, + { + "name": "Maksim Smakouz", + "homepage": "https://github.com/msmakouz" + }, + { + "name": "RoadRunner Community", + "homepage": "https://github.com/roadrunner-server/roadrunner/graphs/contributors" + } + ], + "description": "Base PHP worker for the RoadRunner application server: receives payloads over Goridge, sends responses and manages the worker pool", + "homepage": "https://roadrunner.dev/", + "keywords": [ + "application-server", + "goridge", + "long-running", + "roadrunner", + "worker" + ], + "support": { + "chat": "https://discord.gg/V6EK4he", + "docs": "https://docs.roadrunner.dev/docs/php-worker/worker", + "issues": "https://github.com/roadrunner-server/roadrunner/issues", + "source": "https://github.com/roadrunner-php/worker" + }, + "funding": [ + { + "url": "https://github.com/sponsors/roadrunner-server", + "type": "github" + } + ], + "time": "2026-10-19T08:47:25+00:00" + }, + { + "name": "spiral/security", + "version": "3.17.2", + "source": { + "type": "git", + "url": "https://github.com/spiral/security.git", + "reference": "aefd664efb3e618d0a57c967546f1ad5d9784580" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spiral/security/zipball/aefd664efb3e618d0a57c967546f1ad5d9784580", + "reference": "aefd664efb3e618d0a57c967546f1ad5d9784580", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "spiral/core": "^3.17.2", + "spiral/hmvc": "^3.17.2" + }, + "require-dev": { + "mockery/mockery": "^1.6.12", + "phpunit/phpunit": "^10.5.41", + "spiral/console": "^3.17.2", + "vimeo/psalm": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.17.x-dev" + } + }, + "autoload": { + "psr-4": { + "Spiral\\Security\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Titov (wolfy-j)", + "email": "wolfy-j@spiralscout.com" + }, + { + "name": "Pavel Butchnev (butschster)", + "homepage": "https://github.com/butschster" + }, + { + "name": "Aleksei Gagarin (roxblnfk)", + "homepage": "https://github.com/roxblnfk" + }, + { + "name": "Maksim Smakouz (msmakouz)", + "email": "maksim.smakouz@spiralscout.com" + } + ], + "description": "Spiral, RBAC security layer", + "homepage": "https://spiral.dev", + "support": { + "issues": "https://github.com/spiral/framework/issues", + "source": "https://github.com/spiral/security" + }, + "funding": [ + { + "url": "https://github.com/sponsors/spiral", + "type": "github" + } + ], + "time": "2026-08-05T12:07:41+00:00" + }, + { + "name": "spiral/tokenizer", + "version": "3.17.2", + "source": { + "type": "git", + "url": "https://github.com/spiral/tokenizer.git", + "reference": "fcb7a36672d7aef900dc36377ff997ba6f8cde0b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spiral/tokenizer/zipball/fcb7a36672d7aef900dc36377ff997ba6f8cde0b", + "reference": "fcb7a36672d7aef900dc36377ff997ba6f8cde0b", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=8.1", + "spiral/core": "^3.17.2", + "spiral/logger": "^3.17.2", + "symfony/finder": "^6.4.30 || ^7.4 || ^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.6.12", + "phpunit/phpunit": "^10.5.41", + "spiral/attributes": "^2.8|^3.0", + "spiral/boot": "^3.17.2", + "spiral/files": "^3.17.2", + "vimeo/psalm": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.17.x-dev" + } + }, + "autoload": { + "psr-4": { + "Spiral\\Tokenizer\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -4723,24 +5798,35 @@ ], "authors": [ { - "name": "Resend and contributors", - "homepage": "https://github.com/resend/resend-php/contributors" + "name": "Anton Titov (wolfy-j)", + "email": "wolfy-j@spiralscout.com" + }, + { + "name": "Pavel Butchnev (butschster)", + "homepage": "https://github.com/butschster" + }, + { + "name": "Aleksei Gagarin (roxblnfk)", + "homepage": "https://github.com/roxblnfk" + }, + { + "name": "Maksim Smakouz (msmakouz)", + "email": "maksim.smakouz@spiralscout.com" } ], - "description": "Resend PHP library.", - "homepage": "https://resend.com/", - "keywords": [ - "api", - "client", - "php", - "resend", - "sdk" - ], + "description": "Static Analysis: Class and Invocation locators", + "homepage": "https://spiral.dev", "support": { - "issues": "https://github.com/resend/resend-php/issues", - "source": "https://github.com/resend/resend-php/tree/v1.17.0" + "issues": "https://github.com/spiral/framework/issues", + "source": "https://github.com/spiral/tokenizer" }, - "time": "2026-10-20T03:25:21+00:00" + "funding": [ + { + "url": "https://github.com/sponsors/spiral", + "type": "github" + } + ], + "time": "2026-08-05T12:05:29+00:00" }, { "name": "spomky-labs/base64url", @@ -5692,6 +6778,185 @@ ], "time": "2026-09-28T08:00:04+00:00" }, + { + "name": "symfony/http-client", + "version": "v8.1.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client.git", + "reference": "f892301df77ac25613b19fc2450139c950d1368a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client/zipball/f892301df77ac25613b19fc2450139c950d1368a", + "reference": "f892301df77ac25613b19fc2450139c950d1368a", + "shasum": "" + }, + "require": { + "php": ">=8.4.1", + "psr/log": "^1|^2|^3", + "symfony/deprecation-contracts": "^2.5|^3.0", + "symfony/http-client-contracts": "^3.7", + "symfony/service-contracts": "^2.5|^3" + }, + "conflict": { + "amphp/amp": "<3", + "php-http/discovery": "<1.15" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "1.0", + "symfony/http-client-implementation": "3.0" + }, + "require-dev": { + "amphp/http-client": "^5.3.2", + "amphp/http-tunnel": "^2.0", + "guzzlehttp/guzzle": "^7.10|^8.0", + "nyholm/psr7": "^1.0", + "php-http/httplug": "^1.0|^2.0", + "psr/http-client": "^1.0", + "symfony/cache": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/rate-limiter": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpClient\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", + "homepage": "https://symfony.com", + "keywords": [ + "http" + ], + "support": { + "source": "https://github.com/symfony/http-client/tree/v8.1.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-10-13T15:31:40+00:00" + }, + { + "name": "symfony/http-client-contracts", + "version": "v3.7.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client-contracts.git", + "reference": "35be0019e2c2c9fba80f9dc033290a5240f7b44f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/35be0019e2c2c9fba80f9dc033290a5240f7b44f", + "reference": "35be0019e2c2c9fba80f9dc033290a5240f7b44f", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\HttpClient\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to HTTP clients", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/http-client-contracts/tree/v3.7.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-08-04T08:41:16+00:00" + }, { "name": "symfony/http-foundation", "version": "v8.1.9", @@ -9633,83 +10898,6 @@ ], "time": "2026-10-22T06:15:12+00:00" }, - { - "name": "composer/semver", - "version": "3.5.2", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "9dfce66f1e97360ea5e6d3e38ab14277e4cc591e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/9dfce66f1e97360ea5e6d3e38ab14277e4cc591e", - "reference": "9dfce66f1e97360ea5e6d3e38ab14277e4cc591e", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^1.11", - "symfony/phpunit-bridge": "^3 || ^7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Semver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Version comparison library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "support": { - "irc": "ircs://irc.libera.chat:6697/composer", - "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.5.2" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - } - ], - "time": "2026-10-22T15:37:26+00:00" - }, { "name": "daverandom/libdns", "version": "v2.1.0", @@ -15852,6 +17040,6 @@ "platform": { "php": "^8.5.0" }, - "platform-dev": {}, - "plugin-api-version": "2.9.0" + "platform-dev": [], + "plugin-api-version": "2.6.0" } diff --git a/config/octane.php b/config/octane.php new file mode 100644 index 0000000000..b5b609edc1 --- /dev/null +++ b/config/octane.php @@ -0,0 +1,254 @@ + env('OCTANE_SERVER', 'roadrunner'), + + /* + |-------------------------------------------------------------------------- + | Force HTTPS + |-------------------------------------------------------------------------- + | + | When this configuration value is set to "true", Octane will inform the + | framework that all absolute links must be generated using the HTTPS + | protocol. Otherwise your links may be generated using plain HTTP. + | + */ + + 'https' => env('OCTANE_HTTPS', false), + + /* + |-------------------------------------------------------------------------- + | Octane Listeners + |-------------------------------------------------------------------------- + | + | All of the event listeners for Octane's events are defined below. These + | listeners are responsible for resetting your application's state for + | the next request. You may even add your own listeners to the list. + | + */ + + 'listeners' => [ + WorkerStarting::class => [ + EnsureUploadedFilesAreValid::class, + EnsureUploadedFilesCanBeMoved::class, + ], + + RequestReceived::class => [ + ...Octane::prepareApplicationForNextOperation(), + ...Octane::prepareApplicationForNextRequest(), + // + ], + + RequestHandled::class => [ + // + ], + + RequestTerminated::class => [ + // FlushUploadedFiles::class, + ], + + TaskReceived::class => [ + ...Octane::prepareApplicationForNextOperation(), + // + ], + + TaskTerminated::class => [ + // + ], + + TickReceived::class => [ + ...Octane::prepareApplicationForNextOperation(), + // + ], + + TickTerminated::class => [ + // + ], + + OperationTerminated::class => [ + FlushOnce::class, + FlushTemporaryContainerInstances::class, + // DisconnectFromDatabases::class, + // CollectGarbage::class, + ], + + WorkerErrorOccurred::class => [ + ReportException::class, + StopWorkerIfNecessary::class, + ], + + WorkerStopping::class => [ + CloseMonologHandlers::class, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Warm / Flush Bindings + |-------------------------------------------------------------------------- + | + | The bindings listed below will either be pre-warmed when a worker boots + | or they will be flushed before every new request. Flushing a binding + | will force the container to resolve that binding again when asked. + | + */ + + 'warm' => [ + ...Octane::defaultServicesToWarm(), + ], + + 'flush' => [ + // + ], + + /* + |-------------------------------------------------------------------------- + | Octane Swoole Tables + |-------------------------------------------------------------------------- + | + | While using Swoole, you may define additional tables as required by the + | application. These tables can be used to store data that needs to be + | quickly accessed by other workers on the particular Swoole server. + | + */ + + 'tables' => [ + 'example:1000' => [ + 'name' => 'string:1000', + 'votes' => 'int', + ], + ], + + /* + |-------------------------------------------------------------------------- + | Octane Swoole Cache Table + |-------------------------------------------------------------------------- + | + | While using Swoole, you may leverage the Octane cache, which is powered + | by a Swoole table. You may set the maximum number of rows as well as + | the number of bytes per row using the configuration options below. + | + */ + + 'cache' => [ + 'rows' => 1000, + 'bytes' => 10000, + ], + + /* + |-------------------------------------------------------------------------- + | File Watching + |-------------------------------------------------------------------------- + | + | The following list of files and directories will be watched when using + | the --watch option offered by Octane. If any of the directories and + | files are changed, Octane will automatically reload your workers. + | + */ + + 'watch' => [ + 'app', + 'bootstrap', + 'config/**/*.php', + 'database/**/*.php', + 'public/**/*.php', + 'resources/**/*.php', + 'routes', + 'composer.lock', + '.env', + ], + + /* + |-------------------------------------------------------------------------- + | Garbage Collection Threshold + |-------------------------------------------------------------------------- + | + | When executing long-lived PHP scripts such as Octane, memory can build + | up before being cleared by PHP. You can force Octane to run garbage + | collection if your application consumes this amount of megabytes. + | + */ + + 'garbage' => 50, + + /* + |-------------------------------------------------------------------------- + | Maximum Execution Time + |-------------------------------------------------------------------------- + | + | The following setting configures the maximum execution time for requests + | being handled by Octane. You may set this value to 0 to indicate that + | there isn't a specific time limit on Octane request execution time. + | + */ + + 'max_execution_time' => 30, + + /* + |-------------------------------------------------------------------------- + | Octane Server State File + |-------------------------------------------------------------------------- + | + | This value determines where Octane stores the state file used to track + | the running server's master process ID and admin endpoint, which is + | read by various Octane commands. You may tweak this if necessary. + | + */ + + 'state_file' => env('OCTANE_STATE_FILE', storage_path('logs/octane-server-state.json')), + + /* + |-------------------------------------------------------------------------- + | RoadRunner Options + |-------------------------------------------------------------------------- + | + | The following options are only used when the RoadRunner server is the + | server powering your application. You may customize the path to the + | worker binary here, which is useful for zero-downtime deployments + | where the application is served from a symlinked "current" path. + | + */ + + 'roadrunner' => [ + 'command' => env('OCTANE_ROADRUNNER_COMMAND', 'vendor/bin/roadrunner-worker'), + 'http_middleware' => env('OCTANE_ROADRUNNER_HTTP_MIDDLEWARE', 'static'), + ], + +]; diff --git a/database/migrations/2026_10_29_143753_add_views_count_to_commits_table.php b/database/migrations/2026_10_29_143753_add_views_count_to_commits_table.php new file mode 100644 index 0000000000..037a19e729 --- /dev/null +++ b/database/migrations/2026_10_29_143753_add_views_count_to_commits_table.php @@ -0,0 +1,24 @@ +unsignedBigInteger('views_count')->default(0); + }); + } + + public function down(): void + { + Schema::table('commits', function (Blueprint $table) { + $table->dropColumn('views_count'); + }); + } +}; diff --git a/resources/js/components/commit-card.tsx b/resources/js/components/commit-card.tsx index 80b7ae126f..590628c960 100644 --- a/resources/js/components/commit-card.tsx +++ b/resources/js/components/commit-card.tsx @@ -1,5 +1,5 @@ import { Link, router, usePage } from '@inertiajs/react'; -import { CornerDownRight, Trash2 } from 'lucide-react'; +import { CornerDownRight, Eye, Trash2 } from 'lucide-react'; import type { MouseEvent, PointerEvent, ReactNode } from 'react'; import { useCallback, useContext, useRef, useState } from 'react'; import CommitController from '@/actions/App/Http/Controllers/CommitController'; @@ -521,6 +521,9 @@ export function CommitCard({ {commit.replies_count === undefined ? (
+ + {translation.button} {threadActions} @@ -682,6 +688,19 @@ export function CommitCard({ ); } +function CommitViewsCount({ count }: { count: number }) { + return ( + + + {count} + + ); +} + export function CommitTombstone({ id, previousLane, diff --git a/resources/js/types/commit.ts b/resources/js/types/commit.ts index 4e6b995834..ca12cfd5a0 100644 --- a/resources/js/types/commit.ts +++ b/resources/js/types/commit.ts @@ -86,6 +86,7 @@ export type Commit = { deleted_at?: null; stars_count: number; pasteis_count: number; + views_count: number; starred: boolean; user: User; replies_count?: number; diff --git a/tests/Feature/Controllers/Api/CommitControllerTest.php b/tests/Feature/Controllers/Api/CommitControllerTest.php index 1d9199f107..4b204bc872 100644 --- a/tests/Feature/Controllers/Api/CommitControllerTest.php +++ b/tests/Feature/Controllers/Api/CommitControllerTest.php @@ -41,6 +41,7 @@ 'created_at' => now()->toIso8601ZuluString(), 'stars_count' => 0, 'replies_count' => 0, + 'views_count' => 0, 'link_preview' => null, 'images' => [], 'author' => [ @@ -260,6 +261,7 @@ 'is_pinned' => false, 'starred' => true, 'pasteis_count' => 4, + 'views_count' => 0, 'deleted_at' => null, 'quoted_commit_id' => null, 'quoted_commit' => null, @@ -283,6 +285,7 @@ 'is_pinned' => false, 'starred' => false, 'pasteis_count' => 0, + 'views_count' => 0, 'deleted_at' => null, 'quoted_commit_id' => null, 'quoted_commit' => null, diff --git a/tests/Feature/Controllers/CommitControllerTest.php b/tests/Feature/Controllers/CommitControllerTest.php index 5809dd8422..1a05b9b438 100644 --- a/tests/Feature/Controllers/CommitControllerTest.php +++ b/tests/Feature/Controllers/CommitControllerTest.php @@ -676,6 +676,20 @@ ->missing('commit.user.email')); }); +it('counts and displays one view per session for a commit page', function (): void { + $commit = Commit::factory()->create(); + + $this->get(route('commit.show', [$commit->user, $commit])) + ->assertOk() + ->assertInertia(fn ($page) => $page->where('commit.views_count', 1)); + + $this->get(route('commit.show', [$commit->user, $commit])) + ->assertOk() + ->assertInertia(fn ($page) => $page->where('commit.views_count', 1)); + + expect($commit->refresh()->views_count)->toBe(1); +}); + it('shows as many replies at a time as the viewer picked', function (): void { $commit = Commit::factory()->create(); Commit::factory()->for($commit, 'parent')->count(4)->create(); diff --git a/tests/Unit/CommitImages.test.tsx b/tests/Unit/CommitImages.test.tsx index 8f00ae38c2..b0e52e7184 100644 --- a/tests/Unit/CommitImages.test.tsx +++ b/tests/Unit/CommitImages.test.tsx @@ -25,6 +25,7 @@ const commit: Commit = { updated_at: '2026-10-16T10:00:00Z', stars_count: 0, pasteis_count: 0, + views_count: 0, starred: false, user: { id: 'user-1', diff --git a/tests/Unit/NotificationInbox.test.tsx b/tests/Unit/NotificationInbox.test.tsx index 0e566601f1..6387b28868 100644 --- a/tests/Unit/NotificationInbox.test.tsx +++ b/tests/Unit/NotificationInbox.test.tsx @@ -40,6 +40,7 @@ const quoteCommit: Omit = { updated_at: timestamp, stars_count: 0, pasteis_count: 0, + views_count: 0, starred: false, quoted_commit_id: 'quoted-commit', }; From 1fe000f77ab51f3babf8b64a2e0beae8411cd142 Mon Sep 17 00:00:00 2001 From: Rayiumir Date: Thu, 29 Oct 2026 18:50:46 +0330 Subject: [PATCH 2/2] fix: fix conflicts --- composer.json | 2 -- composer.lock | 2 +- config/octane.php | 5 ++--- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 7269b13e0a..3e7359a79f 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,6 @@ "nunomaduro/essentials": "^1.2.0", "phpseclib/phpseclib": "^4.0.2", "resend/resend-php": "^1.17", - "spiral/roadrunner-cli": "^2.7.2", - "spiral/roadrunner-http": "^3.6.0", "symfony/html-sanitizer": "^8.1.8", "tempest/highlight": "^2.29.0" }, diff --git a/composer.lock b/composer.lock index a401cee019..58ddcf9aae 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "418d8070a1bf087dfaba892f5890ad46", + "content-hash": "cfb4acce122941a5f84ae72f632c3b01", "packages": [ { "name": "aws/aws-crt-php", diff --git a/config/octane.php b/config/octane.php index b5b609edc1..70e3a91120 100644 --- a/config/octane.php +++ b/config/octane.php @@ -1,5 +1,7 @@