{"id":15103756,"url":"https://github.com/erykmika/trim-it","last_synced_at":"2026-02-12T21:31:11.078Z","repository":{"id":223851376,"uuid":"760944956","full_name":"erykmika/trim-it","owner":"erykmika","description":"URL Shortener REST API written in PHP 8","archived":false,"fork":false,"pushed_at":"2024-03-24T19:57:19.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-03T13:47:56.615Z","etag":null,"topics":["api","mysql","php","php8","rest-api"],"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/erykmika.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-21T00:17:48.000Z","updated_at":"2024-03-30T14:20:30.000Z","dependencies_parsed_at":"2024-02-22T12:24:54.200Z","dependency_job_id":"78bee0c5-dbb5-4791-9377-dde62c7f2215","html_url":"https://github.com/erykmika/trim-it","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"943ded0e28319f4081da41dfa5611a925509b1bf"},"previous_names":["erykmika/trim-it"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/erykmika/trim-it","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erykmika%2Ftrim-it","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erykmika%2Ftrim-it/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erykmika%2Ftrim-it/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erykmika%2Ftrim-it/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erykmika","download_url":"https://codeload.github.com/erykmika/trim-it/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erykmika%2Ftrim-it/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29381749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T20:34:40.886Z","status":"ssl_error","status_checked_at":"2026-02-12T20:23:00.490Z","response_time":55,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["api","mysql","php","php8","rest-api"],"created_at":"2024-09-25T19:41:54.602Z","updated_at":"2026-02-12T21:31:11.055Z","avatar_url":"https://github.com/erykmika.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trim-it\n\nA simple REST API written in PHP 8 without using any particular frameworks. It enables a user to shorten (\"trim\") a URL and generate its hash that can be used to retrieve the original URL. The application code was structured in such a way it follows the MVC architecture pattern. **The project is still in development**.\n\n## Tech stack\n\n|             Type             |                            Technology used                           |\n| ---------------------------- |----------------------------------------------------------------------|\n| Core scripting language      | PHP 8                                                                |\n| Database (dev \u0026 test)        | MySQL                                                                |\n| Unit testing                 | PHPUnit                                                              |\n| Dependency management        | composer                                                             |\n\n## Project setup\n\nPHP \u003e= 8.3 is recommended. An instance of active MySQL database with permissions to create/manage databases/users is needed.\n\n### Clone the repository\n\n```sh\ngit clone https://github.com/erykmika/trim-it.git\n```\n\n### Install dependencies (composer)\n\n```sh\ncd ./trim-it/\ncomposer install\n```\nThis assumes \u003ca href=\"https://getcomposer.org/doc/00-intro.md#globally\"\u003ethe global installation of composer\u003c/a\u003e.\n\n### Configure the database\n\nModify **include/db_config.php** and, optionally, **tests/test_db_config.php** to provide database credentials for a development and a testing database respectively. Run the **create_schema.sql** script for both databases to create a proper schema for the application:\n\n```sh\nmysql -u \u003cuser\u003e -p -d \u003cdatabase\u003e \u003c ./sql/create_schema.sql\n```\n\n### Run the application\n\nYou can use the Apache HTTP Server to handle HTTP requests. You will have to expose the **public** directory in the configuration. An **.htaccess** file specifying rewriting rules is provided. For the sake of simplicity, you can also use the in-built PHP web development server:\n\n```sh\ncd ./public/\nphp -S localhost:8080\n```\n\nNow the application will respond to the API requests on the specified addresss.\n\n## Endpoints\n\nThe application handles and serves JSON-encoded requests/responses.\n\n|   Method  |  URL          |   Description     |\n|-----------|---------------|-------------------|\n|   GET     | /url/:hash    | Get full URL      |\n|   POST    | /hash         | Generate URL hash |\n\n### POST JSON body structure\n\n```json\n{\n    \"url\": \"\u003curl to be shortened\u003e\"\n}\n\n```\n\n### Response JSON body structure\n```json\n{\n    \"status\": \"\u003csuccess/failure\u003e\",\n    \"\u003chash/url\u003e\": \"\u003chash/url\u003e\"\n}\n```\n\n## Unit testing\n\nTo launch tests, run the vendor-provided PHPUnit executable.\n\n```sh\n./vendor/bin/phpunit --testdox\n```\n\nThe **--testdox** flag provides more user-friendly output of the tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferykmika%2Ftrim-it","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferykmika%2Ftrim-it","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferykmika%2Ftrim-it/lists"}