{"id":37011923,"url":"https://github.com/folded-php/history","last_synced_at":"2026-01-14T01:01:43.827Z","repository":{"id":62506131,"uuid":"294478852","full_name":"folded-php/history","owner":"folded-php","description":"Manipulate the browser history for your web app.","archived":false,"fork":false,"pushed_at":"2020-10-17T07:51:06.000Z","size":76,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-14T11:24:42.946Z","etag":null,"topics":["browser-history","history","php"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/folded/history","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/folded-php.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-10T17:35:25.000Z","updated_at":"2022-09-02T21:20:43.000Z","dependencies_parsed_at":"2022-11-02T12:31:04.813Z","dependency_job_id":null,"html_url":"https://github.com/folded-php/history","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/folded-php/history","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fhistory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fhistory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fhistory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fhistory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/folded-php","download_url":"https://codeload.github.com/folded-php/history/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fhistory/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28407636,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"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":["browser-history","history","php"],"created_at":"2026-01-14T01:01:42.839Z","updated_at":"2026-01-14T01:01:43.670Z","avatar_url":"https://github.com/folded-php.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# folded/history\n\nManipulate the browser history in your web app.\n\n[![Packagist License](https://img.shields.io/packagist/l/folded/history)](https://github.com/folded-php/history/blob/master/LICENSE) [![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/folded/history)](https://github.com/folded-php/history/blob/master/composer.json#L14) [![Packagist Version](https://img.shields.io/packagist/v/folded/history)](https://packagist.org/packages/folded/history) [![Build Status](https://travis-ci.com/folded-php/history.svg?branch=master)](https://travis-ci.com/folded-php/history) [![Maintainability](https://api.codeclimate.com/v1/badges/388dfdab788e0321f001/maintainability)](https://codeclimate.com/github/folded-php/history/maintainability) [![TODOs](https://img.shields.io/endpoint?url=https://api.tickgit.com/badge?repo=github.com/folded-php/history)](https://www.tickgit.com/browse?repo=github.com/folded-php/history)\n\n## Summary\n\n- [About](#about)\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Examples](#examples)\n- [Version support](#version-support)\n\n## About\n\nI created this library to be able to easily come back to the browsed page after editing a resource. The possibility are endless with this package, which is easy to integrate as it is loosely coupled.\n\nFolded is a constellation of packages to help you setting up a web app easily, using ready to plug in packages.\n\n- [folded/action](https://github.com/folded-php/action): A way to organize your controllers for your web app.\n- [folded/config](https://github.com/folded-php/config): Configuration utilities for your PHP web app.\n- [folded/crypt](https://github.com/folded-php/crypt): Encrypt and decrypt strings for your web app.\n- [folded/exception](https://github.com/folded-php/exception): Various kind of exception to throw for your web app.\n- [folded/http](https://github.com/folded-php/http): HTTP utilities for your web app.\n- [folded/orm](https://github.com/folded-php/orm): An ORM for you web app.\n- [folded/routing](https://github.com/folded-php/routing): Routing functions for your PHP web app.\n- [folded/request](https://github.com/folded-php/request): Request utilities, including a request validator, for your PHP web app.\n- [folded/session](https://github.com/folded-php/session): Session functions for your web app.\n- [folded/view](https://github.com/folded-php/view): View utilities for your PHP web app.\n\n## Features\n\n- Stores the GET requests, by making sure there is not duplicate if the user browse again the same URL\n- Can check if an history index exist\n- Can get an URL by its history index, or get all the urls in the history\n- Uses the PHP session to store the history\n\n## Requirements\n\n- PHP version \u003e= 7.4.0\n- Composer installed\n\n## Installation\n\n- [1. Install the package](#1-install-the-package)\n- [2. Add the bootstrap code](#2-add-the-bootstrap-code)\n\n### 1. Install the package\n\nIn your root folder, run this command:\n\n```bash\ncomposer required folded/history\n```\n\n### 2. Add the bootstrap code\n\nAs early as possible, and by making sure the code is ran before your \"controller\" or \"action\" code, add this:\n\n```php\nuse function Folded\\addRequestedUrlToHistory;\n\nsession_start();\n\naddRequestedUrlToHistory();\n```\n\nEvery time your user browse an URL, it will get added if it matches a GET request.\n\n## Examples\n\n- [1. Get an history by its index](#1-get-an-history-by-its-index)\n- [2. Get the last history](#2-get-the-last-history)\n- [3. Get all the URLs in the history](#3-get-all-the-ur-ls-in-the-history)\n- [4. Check if an index in the history is present](#4-check-if-an-index-in-the-history-is-present)\n\n### 1. Get an history by its index\n\nIn this example, we will get the second last URL by its index in the history.\n\n```php\nuse function Folded\\getHistory;\n\necho getHistory(-1);\n```\n\nThis history starts from 0, and to get the earlier URL, you need to use negative indexes.\n\n- An history of 0 will get the last URL\n- An history of 1 will get the second last URL\n- An history of 2 will get the URL before the second last\n- ...\n\n### 2. Get the last history\n\nIn this example, we will not use any argument to get the last URL in the history.\n\n```php\nuse function Folded\\getHistory;\n\necho getHistory();\n```\n\n### 3. Get all the URLs in the history\n\nIn this example, we will get all the history as an array.\n\n```php\nuse function Folded\\getAllHistory;\n\n$urls = getAllHistory();\n\nforeach ($urls as $url) {\n  echo $url;\n}\n```\n\n### 4. Check if an index in the history is present\n\nIn this example, we will check if an url in the history at a specific index exists.\n\n```php\nuse function Folded\\hasHistory;\n\nif (hasHistory(-1)) {\n  echo \"has history -1\";\n} else {\n  echo \"has not history -1\";\n}\n```\n\n## Version support\n\n|        | 7.3 | 7.4 | 8.0 |\n| ------ | --- | --- | --- |\n| v0.1.0 | ❌  | ✔️  | ❓  |\n| v0.1.1 | ❌  | ✔️  | ❓  |\n| v0.1.2 | ❌  | ✔️  | ❓  |\n| v0.1.3 | ❌  | ✔️  | ❓  |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolded-php%2Fhistory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffolded-php%2Fhistory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolded-php%2Fhistory/lists"}