It worked for me...
This commit is contained in:
@@ -14,8 +14,11 @@ Unit Tests:
|
||||
script: |
|
||||
echo "Running unit tests..."
|
||||
composer run tests:unit:coverage
|
||||
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
reports:
|
||||
junit: tests/reports/junit.xml
|
||||
paths:
|
||||
- tests/reports/
|
||||
|
||||
|
1
.rr.yaml
1
.rr.yaml
@@ -13,6 +13,7 @@ http:
|
||||
destroy_timeout: 5s
|
||||
stream_timeout: 5s
|
||||
num_workers: ${WORKERS:-4}
|
||||
debug: ${DEBUG:-false}
|
||||
|
||||
address: 0.0.0.0:${HTTP_PORT:-9501}
|
||||
access_logs: ${ACCESS_LOGS:-true}
|
||||
|
@@ -20,7 +20,6 @@ docker run --rm -v $(PWD):/app siteworxpro/migrate:v4.18.3 create -ext sql -dir
|
||||
```text
|
||||
postgres://siteworxpro:password@localhost:5432/siteworxpro?sslmode=disable
|
||||
```
|
||||
```
|
||||
|
||||
```shell
|
||||
docker run --rm -v $(PWD):/app siteworxpro/migrate:v4.18.3 -database "postgres://siteworxpro:password@localhost:5432/siteworxpro?sslmode=disable" -path /app/db/migrations up
|
||||
|
@@ -15,7 +15,8 @@
|
||||
"nyholm/psr7": "^1.8",
|
||||
"illuminate/support": "^v12.10.2",
|
||||
"roadrunner-php/app-logger": "^1.2",
|
||||
"siteworxpro/config": "^1.1"
|
||||
"siteworxpro/config": "^1.1",
|
||||
"predis/predis": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^12.1",
|
||||
@@ -32,18 +33,18 @@
|
||||
"composer run-script tests:phpstan"
|
||||
],
|
||||
"tests:unit": [
|
||||
"phpunit --colors=always --display-deprecations tests "
|
||||
"phpunit --colors=always --display-deprecations tests"
|
||||
],
|
||||
"tests:unit:coverage": [
|
||||
"phpunit --colors=always --display-deprecations --coverage-html tests/reports/html tests "
|
||||
"phpunit --coverage-text --colors=never --display-deprecations --log-junit tests/reports/junit.xml --coverage-html tests/reports/html tests "
|
||||
],
|
||||
"tests:lint": [
|
||||
"phpcs ./src --standard=PSR12 --colors -v",
|
||||
"phpcs ./tests --standard=PSR12 --colors -v"
|
||||
"phpcs ./src/**/*.php --standard=PSR12 --colors -v",
|
||||
"phpcs ./tests/**/*.php --standard=PSR12 --colors -v"
|
||||
],
|
||||
"tests:lint:fix": [
|
||||
"phpcbf ./src --standard=PSR12 --colors -v",
|
||||
"phpcbf ./tests --standard=PSR12 --colors -v"
|
||||
"phpcbf ./src/**/*.php --standard=PSR12 --colors -v",
|
||||
"phpcbf ./tests/**/*.php --standard=PSR12 --colors -v"
|
||||
],
|
||||
"tests:license": [
|
||||
"composer-license-checker"
|
||||
|
65
composer.lock
generated
65
composer.lock
generated
@@ -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": "597f3c330fcbd311310b6c23e67f82ad",
|
||||
"content-hash": "df37f9da9922c8145a3adf10809cee4c",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
@@ -1050,6 +1050,69 @@
|
||||
],
|
||||
"time": "2024-09-09T07:06:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "predis/predis",
|
||||
"version": "v3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/predis/predis.git",
|
||||
"reference": "7d86f7afb37940bfc7aaa2909147616881377667"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/predis/predis/zipball/7d86f7afb37940bfc7aaa2909147616881377667",
|
||||
"reference": "7d86f7afb37940bfc7aaa2909147616881377667",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0",
|
||||
"psr/http-message": "^1.0|^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.3",
|
||||
"phpstan/phpstan": "^1.9",
|
||||
"phpunit/phpcov": "^6.0 || ^8.0",
|
||||
"phpunit/phpunit": "^8.0 || ~9.4.4"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-relay": "Faster connection with in-memory caching (>=0.6.2)"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Predis\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Till Krüss",
|
||||
"homepage": "https://till.im",
|
||||
"role": "Maintainer"
|
||||
}
|
||||
],
|
||||
"description": "A flexible and feature-complete Redis/Valkey client for PHP.",
|
||||
"homepage": "http://github.com/predis/predis",
|
||||
"keywords": [
|
||||
"nosql",
|
||||
"predis",
|
||||
"redis"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/predis/predis/issues",
|
||||
"source": "https://github.com/predis/predis/tree/v3.0.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sponsors/tillkruss",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-05-02T23:18:59+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/clock",
|
||||
"version": "1.0.0",
|
||||
|
@@ -28,5 +28,11 @@ return [
|
||||
'allowed_origins' => Env::get('CORS_ALLOWED_ORIGINS', 'localhost:3000'),
|
||||
'allow_credentials' => Env::get('CORS_ALLOW_CREDENTIALS', true, 'bool'),
|
||||
'max_age' => Env::get('CORS_MAX_AGE', ''),
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'host' => Env::get('REDIS_HOST', 'localhost'),
|
||||
'port' => Env::get('REDIS_PORT', 6379, 'int'),
|
||||
'database' => Env::get('REDIS_DATABASE', 0, 'int'),
|
||||
]
|
||||
];
|
@@ -1,7 +1,16 @@
|
||||
volumes:
|
||||
pgdata: {}
|
||||
redisdata: {}
|
||||
|
||||
services:
|
||||
|
||||
composer-runtime:
|
||||
volumes:
|
||||
- .:/app
|
||||
image: siteworxpro/composer
|
||||
entrypoint: "/bin/sh -c 'while true; do sleep 30; done;'"
|
||||
environment:
|
||||
PHP_IDE_CONFIG: serverName=localhost
|
||||
|
||||
dev-runtime:
|
||||
ports:
|
||||
- "9501:9501"
|
||||
@@ -11,13 +20,18 @@ services:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
entrypoint: "/bin/sh -c 'while true; do sleep 30; done;'"
|
||||
environment:
|
||||
PHP_IDE_CONFIG: serverName=localhost
|
||||
WORKERS: 1
|
||||
DEBUG: 1
|
||||
REDIS_HOST: redis
|
||||
|
||||
migrations:
|
||||
image: siteworxpro/migrate:v4.18.3
|
||||
restart: no
|
||||
redis:
|
||||
image: redis:latest
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- .:/app
|
||||
command: "-database 'postgres://${DB_DATABASE-siteworxpro}:${DB_PASSWORD-password}@${DB_HOST-postgres}:5432/siteworxpro?sslmode=disable' -path /app/db/migrations up"
|
||||
- redisdata:/data
|
||||
|
||||
postgres:
|
||||
image: postgres:latest
|
||||
|
52
src/Facades/Redis.php
Normal file
52
src/Facades/Redis.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Siteworxpro\App\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
use Predis\Client;
|
||||
use Predis\Response\Status;
|
||||
|
||||
/**
|
||||
* Facade for the Redis client.
|
||||
*
|
||||
* This class provides a static interface to interact with the Redis client.
|
||||
*
|
||||
* @method static array scan($cursor, ?array $options = null)
|
||||
* @method static string|null get(string $key)
|
||||
* @method static Status|null set(string $key, $value, $expireResolution = null, $expireTTL = null, $flag = null)
|
||||
* @method static array keys(string $pattern)
|
||||
* @method static int del(string $key)
|
||||
*/
|
||||
class Redis extends Facade
|
||||
{
|
||||
public static function getFacadeRoot(): Client
|
||||
{
|
||||
if (self::$resolvedInstance !== null) {
|
||||
$redis = self::resolveFacadeInstance(self::getFacadeAccessor());
|
||||
|
||||
if ($redis instanceof Client) {
|
||||
return $redis;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new Redis client instance if not already resolved
|
||||
return new Client([
|
||||
'scheme' => 'tcp',
|
||||
'host' => Config::get('redis.host'),
|
||||
'port' => Config::get('redis.port'),
|
||||
'database' => Config::get('redis.database'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string The name of the component.
|
||||
*/
|
||||
protected static function getFacadeAccessor(): string
|
||||
{
|
||||
return Client::class;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user