{"id":26487858,"url":"https://github.com/studio24/staging-site-password","last_synced_at":"2026-04-13T16:02:30.769Z","repository":{"id":265888952,"uuid":"847276259","full_name":"studio24/staging-site-password","owner":"studio24","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-25T11:12:26.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-05T05:06:00.602Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/studio24.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":"2024-08-25T11:10:11.000Z","updated_at":"2024-08-25T11:12:29.000Z","dependencies_parsed_at":"2024-12-01T11:46:58.885Z","dependency_job_id":null,"html_url":"https://github.com/studio24/staging-site-password","commit_stats":null,"previous_names":["studio24/staging-site-password"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/studio24/staging-site-password","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/studio24%2Fstaging-site-password","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/studio24%2Fstaging-site-password/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/studio24%2Fstaging-site-password/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/studio24%2Fstaging-site-password/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/studio24","download_url":"https://codeload.github.com/studio24/staging-site-password/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/studio24%2Fstaging-site-password/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31759540,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T15:25:13.801Z","status":"ssl_error","status_checked_at":"2026-04-13T15:25:09.162Z","response_time":93,"last_error":"SSL_read: 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":[],"created_at":"2025-03-20T06:53:41.800Z","updated_at":"2026-04-13T16:02:30.729Z","avatar_url":"https://github.com/studio24.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Staging site password\n\nA simple tool to password restrict a staging environment. \n\n## What does it do?\n\nWhen creating or updating a website it's good practise to publish changes to a staging environment to review before going live.\n\nThis package helps secure staging websites behind a simple, accessible login page. This is easier to use than basic authentication and \nremembers your login in a cookie, so you don't have to keep entering your password.\n \n[![Screenshot of the staging site password login page](screenshot.png)](screenshot.png)\n\n## Requirements\n\n* PHP 7.4+\n* [Composer](https://getcomposer.org/)\n\n## Installation\n\nInstall via Composer:\n\n```bash\ncomposer require studio24/staging-site-passsword:^1.0\n```\n\n## Usage\n\n### Create a password hash\n\nYour staging site password needs to be stored as secure hash. You can generate this via [password_hash](https://www.php.net/password-hash) \nor by using the provided command line script.  \n\n```bash\nphp vendor/bin/password-hash.php\n```\n\n### Store the password hash\n\nTODO\n\n\nStore the password hash in an environment variable or PHP constant. The example below is for the password \"test123\"\n\nEnvironment variable:\n\n```php\nputenv('STAGING_SITE_PASSWORD=$2y$10$pvDrmW9GW0bLVDMtLwLnn.mFof5eQQwlozZ5kYK7xijQRVAWUw0FK');\n```\n\nPHP constant:\n\n```php\ndefine('STAGING_SITE_PASSWORD', '$2y$10$pvDrmW9GW0bLVDMtLwLnn.mFof5eQQwlozZ5kYK7xijQRVAWUw0FK');\n```\n\nOr in PHP:\n\n```php\n$controller-\u003eauth-\u003esetPasswordHash($hash); \n```\n\n### Integrate with your website\n\n#### WordPress\n\nTODO\n\n#### Laravel\n\n#### PHP websites\n\nEnable the staging site login page via:\n\n```php\n$controller = new \\Studio24\\StagingSitePassword\\Controller();\nif ($controller-\u003eisStaging()) {\n    $controller-\u003eauthenticate();\n}\n```\n\n## How to customise the login page\n\nIf you want to customise any options, you can do so via the controller object. Make sure you add your code before `$controller-\u003eauthenticate()` \nis run. For example:\n\n```php\n$controller = new \\Studio24\\StagingSitePassword\\Controller();\n$controller-\u003eloginPage-\u003esetPlaceholder('title', 'Login to My Website');\nif ($controller-\u003eisStaging()) {\n    $controller-\u003eauthenticate();\n}\n```\n\n### Text\n\nYou can customise any text on the login page via `$controller-\u003eloginPage-\u003esetPlaceholder($name, $value)`.\n\nCustomise the title:\n\n```php\n$controller-\u003eloginPage-\u003esetPlaceholder('title', 'Login to My Website');\n```\n\nCustomise the footer text (you can include HTML):\n\n```php\n$controller-\u003eloginPage-\u003esetPlaceholder('footer', 'Get support from \u003ca href=\"mailto:support@studio24.net\"\u003eStudio 24\u003c/a\u003e');\n```\n\nThe full list of placeholders:\n\n| Placeholder  | Default content |\n|--------------|-----------------|\n| `title` | Login to staging website   |\n| `footer` |     |\n| `password_field_label` | Password    |\n| `submit_field_label` | Login    |\n| `title_prefix_on_error` | Error:     |\n| `error_message_title` | There is a problem    |\n| `error_message` | The password is incorrect    |\n| `show` | Show    |\n| `hide` | Hide    |\n| `show_password` | Show password    |\n| `hide_password` | Hide password    |\n\n### Cookie lifetime\n\nBy default, the login cookie is set to expire after 1 day. You can customise this via:\n\n```php\n$controller-\u003eauth-\u003esetCookieLifetime(3600); \n```\n\nThis sets the cookie lifetime in seconds.\n\nYou can also set this in days:\n\n```php\n$controller-\u003eauth-\u003esetCookieLifetimeInDays(7); \n```\n\nYou can also change the cookie name (default is `staging_site_remember_login`):\n\n```php\n$controller-\u003eauth-\u003esetCookieName('remember_me'); \n``` ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstudio24%2Fstaging-site-password","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstudio24%2Fstaging-site-password","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstudio24%2Fstaging-site-password/lists"}