diff --git a/CHANGELOG.md b/CHANGELOG.md index 3af7bf1..773a62f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,10 @@ # CHANGELOG -## v2.0.5 (unreleased) +## v2.0.5 (Current) (Stable) **Installation:** ```bash -composer require dconco/phpspa:v2.0.5.x-dev +composer require dconco/phpspa:v2.0.5 ``` ### What's Added @@ -54,7 +54,7 @@ new Component(...) ->meta(property: 'og:title', content: 'PhpSPA Design System'); ``` -**Documentation:** [references/component-meta](https://phpspa.readthedocs.io/en/latest/references/component-meta) +**Documentation:** [references/component-meta](https://phpspa.tech/references/component-meta) #### **`useCallback()`** @@ -102,11 +102,16 @@ $app -## v2.0.4 (Current) (Stable) +## v2.0.4 > [!IMPORTANT] > This version requires **PHP 8.4 or higher** +**Installation:** +```bash +composer require dconco/phpspa:v2.0.4 +``` + ### **Client-Side Hooks** ⚛️ - **`useEffect()`** - Manage side effects and cleanups in your component scripts with dependency tracking @@ -259,6 +264,11 @@ $app->prefix('/api', function (Router $router) { ## v2.0.3 +**Installation:** +```bash +composer require dconco/phpspa:v2.0.3 +``` + ### ✨ New Features #### **Native C++ Compression Engine** ⚡ diff --git a/app/core/Client/CurlHttpClient.php b/app/core/Client/CurlHttpClient.php index a1e502b..a800172 100644 --- a/app/core/Client/CurlHttpClient.php +++ b/app/core/Client/CurlHttpClient.php @@ -191,13 +191,13 @@ public function prepareAsync(string $url, string $method, array $headers, ?strin curl_setopt($ch, CURLOPT_TIMEOUT_MS, (int)($timeout * 1000)); } else { // Use seconds for timeouts >= 1 - curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout); + curl_setopt($ch, CURLOPT_TIMEOUT, (int) $timeout); } - + $connectTimeout = $options['connect_timeout'] ?? 10; curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, (int) $connectTimeout); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $options['verify_ssl'] ?? false); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, ($options['verify_ssl'] ?? false) ? 2 : 0); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $options['verify_ssl'] ?? true); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, ($options['verify_ssl'] ?? true) ? 2 : 0); // --- Handle Unix Socket --- if (isset($options['unix_socket_path'])) { @@ -207,11 +207,11 @@ public function prepareAsync(string $url, string $method, array $headers, ?strin if (isset($options['cert_path'])) { curl_setopt($ch, CURLOPT_CAINFO, $options['cert_path']); } - + if (isset($options['user_agent'])) { curl_setopt($ch, CURLOPT_USERAGENT, $options['user_agent']); } - + // Build headers array for cURL $curlHeaders = []; foreach ($headers as $key => $value) { diff --git a/app/core/Client/PendingRequest.php b/app/core/Client/PendingRequest.php index b999cbb..1590600 100644 --- a/app/core/Client/PendingRequest.php +++ b/app/core/Client/PendingRequest.php @@ -121,6 +121,12 @@ public function connectTimeout(int $seconds): PendingRequest return $this; } + public function unixSocketPath(string $path): PendingRequest + { + $this->options['unix_socket_path'] = $path; + return $this; + } + /** * Set the Unix domain socket path to be used for this pending request. * diff --git a/app/core/Helper/StateManager.php b/app/core/Helper/StateManager.php index f4d496c..26eb680 100644 --- a/app/core/Helper/StateManager.php +++ b/app/core/Helper/StateManager.php @@ -68,13 +68,16 @@ public function __construct(string $stateKey, $default) * @param mixed $value Optional value to be processed when the object is invoked. * @return mixed The result of the invocation, depending on the implementation. */ - public function __invoke($value = UNDEFINED_STATE_VARIABLE) + public function __invoke() { $sessionData = SessionHandler::get(STATE_HANDLE); - if ($value === UNDEFINED_STATE_VARIABLE) { + // If no argument was passed, return the current state value. + if (\func_num_args() === 0) { return $sessionData[$this->stateKey] ?? $this->value; } + // An argument was explicitly provided (even if it is falsy); treat it as the new state value. + $value = func_get_arg(0); $this->lastState = $this->value ?? Validate::validate($value); $this->value = $value; diff --git a/badge/loc.svg b/badge/loc.svg index 45a4ec7..d767eae 100644 --- a/badge/loc.svg +++ b/badge/loc.svg @@ -12,8 +12,8 @@ Lines of Code Lines of Code - 16,124 - 16,124 + 16,127 + 16,127 \ No newline at end of file diff --git a/docs/references/index.md b/docs/references/index.md index 8406bc6..678b880 100644 --- a/docs/references/index.md +++ b/docs/references/index.md @@ -40,7 +40,7 @@ Learn how the `@dconco/phpspa` package bootstraps navigation, state sync, and client helpers. - [:octicons-arrow-right-24: Open guide](https://phpspa-client.vercel.app) + [:octicons-arrow-right-24: Open guide](https://phpspa-client.up.railway.app)