{"id":31915470,"url":"https://github.com/stackify/stackify-api-php","last_synced_at":"2025-10-13T19:47:29.357Z","repository":{"id":22925029,"uuid":"26274045","full_name":"stackify/stackify-api-php","owner":"stackify","description":"Stackify Log API for PHP","archived":false,"fork":false,"pushed_at":"2024-05-20T12:32:58.000Z","size":206,"stargazers_count":4,"open_issues_count":0,"forks_count":10,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-09-20T06:59:26.483Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stackify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-11-06T14:40:36.000Z","updated_at":"2024-05-09T13:18:31.000Z","dependencies_parsed_at":"2024-05-09T14:16:05.690Z","dependency_job_id":"78de2ad0-b5b5-449c-b095-35b494ab84b6","html_url":"https://github.com/stackify/stackify-api-php","commit_stats":{"total_commits":163,"total_committers":17,"mean_commits":9.588235294117647,"dds":"0.41104294478527603","last_synced_commit":"0b1ba18bd9d11c6fda7bc0132fdc02dcf532fc97"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/stackify/stackify-api-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-api-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-api-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-api-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-api-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackify","download_url":"https://codeload.github.com/stackify/stackify-api-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-api-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279016839,"owners_count":26085889,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-13T19:47:27.558Z","updated_at":"2025-10-13T19:47:29.338Z","avatar_url":"https://github.com/stackify.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PHP version](https://badge.fury.io/ph/stackify%2Flogger.svg)](http://badge.fury.io/ph/stackify%2Flogger)\n\n# Stackify PHP Logger \n\nStandalone Stackify PHP [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) Logger. \n\n* **Errors and Logs Overview:** http://support.stackify.com/errors-and-logs-overview/\n* **Sign Up for a Trial:** http://www.stackify.com/sign-up/\n\n## PHP Logging Framework Integrations\n\n* **Monolog** Handler: https://github.com/stackify/stackify-log-monolog\n* **log4php** Appender: https://github.com/stackify/stackify-log-log4php\n\n\n## Installation\n\nInstall the latest version with `composer require stackify/logger`\n\n### Requirements\n* Stackify PHP Logger ^2.0 works with PHP 7.1 or above.\n* Stackify PHP Logger ^1.0 works with PHP 5.3 or above.\n\n### Installation with Linux Agent \n\nThis is the suggested installation option, offering the best \nlogging performance. \n\n```php\nuse Stackify\\Log\\Standalone\\Logger;\n\n$logger = new Logger('application_name', 'environment_name');\n```\n\n### Installation without Linux Agent\n\nThis option does not require the Stackify Agent to be installed because it sends data directly to Stackify services. It collects log entries in batches, calls curl using the ```exec``` function, and sends data to the background immediately [```exec('curl ... \u0026')```]. This will affect the performance of your application minimally, but it requires permissions to call ```exec``` inside the PHP script and it may cause silent data loss in the event of any network issues. This transport method does not work on Windows. To configure ExecTransport you need to pass the environment name and API key (license key):\n   \n```php\nuse Stackify\\Log\\Transport\\ExecTransport;\nuse Stackify\\Log\\Standalone\\Logger;\n    \n$transport = new ExecTransport('api_key');\n$logger = new Logger('application_name', 'environment_name', $transport);\n```   \n\n#### Optional Settings\n\n**Proxy**\n- ExecTransport supports data delivery through proxy. Specify proxy using [libcurl format](http://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html): `\u003c[protocol://][user:password@]proxyhost[:port]\u003e`\n```php\n$transport = new ExecTransport($apiKey, ['proxy' =\u003e 'https://55.88.22.11:3128']);\n```\n\n**Curl path**\n- It can be useful to specify ```curl``` destination path for ExecTransport. This option is set to 'curl' by default.\n```php\n$transport = new ExecTransport($apiKey, ['curlPath' =\u003e '/usr/bin/curl']);\n```\n\n**Log Server Environment Variables**\n- Server environment variables can be added to error log message metadata. **Note:** This will log all \nsystem environment variables; do not enable if sensitive information such as passwords or keys are stored this way.\n\n ```php\n$logger = new Logger('application_name', 'environment_name', $transport, true);\n```\n\n### **Configuration Settings**\n- This allow users to override default settings of the logger (Masking Request Variables, Session, Cookie or Updating connection properties to different Transports etc.)\n- **Note** - By default capturing raw post data `(e.g. file_get_contents(\"php://input\"))` and `$_POST` variables are `DISABLED` by default \n    - To enable you can set the following options to `true`\n    - `CapturePostVariables` - `Boolean` - Capture `$_POST` variables\n    - `CaptureRawPostData` - `Boolean` - Capture `php://input` stream data `(e.g. file_get_contents(\"php://input\"))`\n        ```php\n        $config = array(\n                'CapturePostVariables' =\u003e true,\n                'CaptureRawPostData' =\u003e true,\n                ...\n        );\n        ```\n- **Note** - For the `Whitelist/Blackist` setting. Anything `falsy` (`null`, `false`, `array()` etc. - Refer to php [empty](https://www.php.net/manual/en/function.empty.php) function checking) will be considered as `Do Not Track` - No variable data will be processed.\n\n#### Logger Level\n ```php\n$config = array(\n        'CaptureServerVariables' =\u003e false,\n        'CaptureServerVariablesWhitelist' =\u003e '*',\n        'CaptureServerVariablesBlacklist' =\u003e 'REMOTE_ADDR,SERVER_ADDR',\n        ...\n    );\n\n$logger = new Logger('application_name', 'environment_name', $transport, true, $config);\n```\n\n#### Transport Level\n- This applies to all the transports `(ExecTransport, CurlTransport, AgentTransport, AgentSocketTransport)`\n ```php\n$config = array(\n        'CaptureServerVariables' =\u003e false,\n        'CaptureServerVariablesWhitelist' =\u003e '*',\n        'CaptureServerVariablesBlacklist' =\u003e 'REMOTE_ADDR,SERVER_ADDR',\n        ...\n    );\n\n$transport = new ExecTransport($apiKey, [\n    'config' =\u003e $config\n]);\n```\n### Available Options:\n#### Server Variables\n- `CaptureServerVariables` - `Boolean` - Capture `$_SERVER` variables\n- `CaptureServerVariablesWhitelist` - `Array` or `Comma-delimited string` - Whitelist `$_SERVER` attributes\n- `CaptureServerVariablesBlacklist` - `Array` or `Comma-delimited string` - Mask `$_SERVER` attributes (e.g. `attribute =\u003e 'X-MASKED-X'`)\n#### Get Variables\n- `CaptureGetVariables` - `Boolean` - Capture `$_GET` variables\n- `CaptureGetVariablesWhitelist` - `Array` or `Comma-delimited string` - Whitelist `$_GET` attributes\n- `CaptureGetVariablesBlacklist` - `Array` or `Comma-delimited string` - Mask `$_GET` attributes (e.g. `attribute =\u003e 'X-MASKED-X'`)\n#### Post Variables\n- `CapturePostVariables` - `Boolean` - Capture `$_POST` variables\n- `CapturePostVariablesWhitelist` - `Array` or `Comma-delimited string` - Whitelist `$_POST` attributes\n- `CapturePostVariablesBlacklist` - `Array` or `Comma-delimited string` - Mask `$_POST` attributes (e.g. `attribute =\u003e 'X-MASKED-X'`)\n#### Session Variables\n- `CaptureSessionVariables` - `Boolean` - Capture `$_SESSION` variables\n- `CaptureSessionVariablesWhitelist` - `Array` or `Comma-delimited string` - Whitelist `$_SESSION` attributes\n- `CaptureSessionVariablesBlacklist` - `Array` or `Comma-delimited string` - Mask `$_SESSION` attributes (e.g. `attribute =\u003e 'X-MASKED-X'`)\n#### Error Headers\n- `CaptureErrorHeaders` - `Boolean` - Capture `HEADER` attributes available in `$_SERVER` variable\n- `CaptureErrorHeadersWhitelist` - `Array` or `Comma-delimited string` - Whitelist `HEADER` attributes in `$_SERVER` variable\n- `CaptureErrorHeadersBlacklist` - `Array` or `Comma-delimited string` - Mask `HEADER` attributes in `$_SERVER` variable (e.g. `attribute =\u003e 'X-MASKED-X'`)\n#### Error Cookies\n- `CaptureErrorCookies` - `Boolean` - Capture `$_COOKIE` variables\n- `CaptureErrorCookiesWhitelist` - `Array` or `Comma-delimited string` - Whitelist `$_COOKIE` attributes\n- `CaptureErrorCookiesBlacklist` - `Array` or `Comma-delimited string` - Mask `$_COOKIE` attributes\n#### Capture Raw Post Data\n- `CaptureRawPostData` - `Boolean` - Capture `php://input` stream data `(e.g. file_get_contents(\"php://input\"))`\n#### Debug Settings\n- `Debug` - `Boolean` - Enable DEBUG in the logger\n- `DebugLogPath` - `String` - A qualified path for the log file produced during debug or error\n#### Agent Transport Settings\n- `Protocol` - `String` - Protocol can be `tcp` or `udp`\n- `Host` - `String` - Server Hostname\n- `Port` - `Numeric` - Port\n- `SocketTimeoutConnect` - `Numeric` - Connection Request Timeout\n- `SocketTimeoutWrite` - `Numeric` - Connection Write Timeout\n- `SocketMaxConnectAttempts` - `Numeric` - Connection Attempts\n#### Agent Socket Transport Settings\n- `DomainSocketPath` - `String` - Stackify Agent unix socket path\n#### API or Curl Exec Socket Transport Settings\n- `ApiBaseUrl` - `String` - Stackify API base url\n- `ApiCallLogsEndpoint` - `String` - Stackify API Call Logs endpoint\n- `ApiMaxTimeout` - `Numeric` - Stackify API Call Max Timeout\n- `ApiVersionHeader` - `String` - Stackify API Version Header\n\n#### Troubleshooting\n\nIf transport does not work, try looking into ```vendor\\stackify\\logger\\src\\Stackify\\debug\\log.log``` file (if it is available for writing). Errors are also written to global PHP [error_log](http://php.net/manual/en/errorfunc.configuration.php#ini.error-log).\nNote that ExecTransport does not produce any errors at all, but you can switch it to debug mode:\n```php\n$transport = new ExecTransport($apiKey, ['debug' =\u003e true]);\n```\n\nYou can set it also on the `Logger` level. Setting the `Debug` and `DebugLogPath`\n\n```php\n$config = array(\n        'DebugLogPath' =\u003e '/path/to/log.log',\n        'Debug' =\u003e true\n    );\n\n$logger = new Logger('application_name', 'environment_name', $transport, true, $config);\n```\n\n### **Real User Monitoring (RUM)**\n\nReal user monitoring injects a script tag containing the [RUM JS](https://stackify.com/retrace-real-user-monitoring/) that is responsible for capturing information about the http requests on the browser. This approach is manual and needs to be configured.\n\n#### RUM - Setup\n\n```php\n/** Requires composer **/\n$applicationName = 'Your Application Name';\n$environment = 'YourEnvironment';\n$rumKey = 'YourRumKey';\n \n\\Stackify\\Utils\\Rum::getInstance()-\u003esetupConfiguration(\n\t$applicationName,\n\t$environment,\n\t$rumKey\n);\n```\n\n#### RUM - Application\n```php\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n\t\u003cmeta charset=\"utf-8\" /\u003e\n\t\u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /\u003e\n\t\u003c?php echo \\Stackify\\Utils\\Rum::getInstance()-\u003einsertRumScript(); ?\u003e\n\t\u003ctitle\u003eTitle\u003c/title\u003e\n\u003c/head\u003e\n...\n```\n\n## License\n\nCopyright 2019 Stackify, LLC.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackify%2Fstackify-api-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackify%2Fstackify-api-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackify%2Fstackify-api-php/lists"}