{"id":44528583,"url":"https://github.com/carloswph/wp-secure-headers","last_synced_at":"2026-02-13T18:22:19.177Z","repository":{"id":62499790,"uuid":"342445508","full_name":"carloswph/wp-secure-headers","owner":"carloswph","description":"A simple helper class to manage HTTP Security Headers made available when a Wordpress website is under any SSL certificate.","archived":false,"fork":false,"pushed_at":"2021-04-16T09:22:49.000Z","size":14,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-03T11:17:35.370Z","etag":null,"topics":["php-library","plugins","security-tools","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/carloswph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-26T02:57:38.000Z","updated_at":"2023-04-02T13:27:47.000Z","dependencies_parsed_at":"2022-11-02T10:01:13.339Z","dependency_job_id":null,"html_url":"https://github.com/carloswph/wp-secure-headers","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/carloswph/wp-secure-headers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloswph%2Fwp-secure-headers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloswph%2Fwp-secure-headers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloswph%2Fwp-secure-headers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloswph%2Fwp-secure-headers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carloswph","download_url":"https://codeload.github.com/carloswph/wp-secure-headers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloswph%2Fwp-secure-headers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29414278,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T06:24:03.484Z","status":"ssl_error","status_checked_at":"2026-02-13T06:23:12.830Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["php-library","plugins","security-tools","wordpress"],"created_at":"2026-02-13T18:22:18.960Z","updated_at":"2026-02-13T18:22:19.166Z","avatar_url":"https://github.com/carloswph.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WP Secure Headers Helper\n\nA simple helper class to manage HTTP Security Headers made available when a website is under any SSL certificate. Unfortunately, many plugins are used to configure SSL, but miss the more elaborated part of it - include secure headers to requests. This class aims to offer a simple interface to set up those - bringing predefined headers adequate for most WP websites, but also enabling the coder to set or alter any header - and that may include customized HTTP headers as well.\n\n# Installation\n\nAs we prefer, this library can be installed using Composer\n\n`composer require carloswph/wp-secure-headers`.\n\nAlternatively, you can just copy the class inside the `src` folder and use it in your plugin or theme.\n\n# Usage\n\nThe class `WPH\\Security\\Headers` inserts secure headers for Wordpress. Having that said, it already comes with some basic headers, which can be seen by using the static method `wPH\\Security\\Headers::list()`. In the future, we intend to build some chained methods to allow configuring in detail two specific headers: Content-Security-Policy and Permissions-Policy. For the moment, both can be added to class instance through the `set()` method.\n\n## Using with Composer\n\n```php\nuse WPH\\Security\\Headers;\n\nrequire __DIR__ . '/vendor/autoload.php';\n\n$sec_headers = new Headers();\n$sec_headers-\u003eset('Content-Security-Policy', 'connect-src \"self\"'); // Add new headers to the class array property.\n```\n## Content Security Policy\n\nSince version 1.2.0, this library has an additional class, which can be passed as argument through the main class and adds the Content-Security-Policy header after being configured with dozens of chain methods. An example:\n\n```php\nuse WPH\\Security\\Headers;\nuse WPH\\Security\\ContentSecurityPolicy\n\nrequire __DIR__ . '/vendor/autoload.php';\n\n$csp = new ContentSecurityPolicy();\n$csp-\u003esetChild('https://google.com https://microsoft.com')\n    -\u003esetConnect('https://*');\n\n$sec_headers = new Headers($csp); // Adds the Content-Security-Policy to the headers pool, with all set parameters\n```\nBesides all methods to the configure the various Content-Security-Policy directives individually, this additional class also has a method ReportOnly(), which indicates the main class that the header shall be set as Content-Security-Policy-Report-Only instead. All documentation and info about this complex header can be found inside the class docblock comments.\n\n# Todo\n\n* Methods to setup and configure Permissions Policy headers\n* Some cookie managing tools\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarloswph%2Fwp-secure-headers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarloswph%2Fwp-secure-headers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarloswph%2Fwp-secure-headers/lists"}