{"id":37000290,"url":"https://github.com/fyyb/express","last_synced_at":"2026-01-14T00:02:10.778Z","repository":{"id":62508465,"uuid":"235838929","full_name":"fyyb/express","owner":"fyyb","description":"PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.","archived":false,"fork":false,"pushed_at":"2022-01-04T23:34:04.000Z","size":113,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-25T20:07:12.691Z","etag":null,"topics":["api","composer","framework","micro","php","php-micro-framework","router"],"latest_commit_sha":null,"homepage":null,"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/fyyb.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":"2020-01-23T16:41:32.000Z","updated_at":"2022-08-08T22:03:04.000Z","dependencies_parsed_at":"2022-11-02T13:00:28.804Z","dependency_job_id":null,"html_url":"https://github.com/fyyb/express","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/fyyb/express","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fyyb%2Fexpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fyyb%2Fexpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fyyb%2Fexpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fyyb%2Fexpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fyyb","download_url":"https://codeload.github.com/fyyb/express/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fyyb%2Fexpress/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","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":["api","composer","framework","micro","php","php-micro-framework","router"],"created_at":"2026-01-14T00:02:10.042Z","updated_at":"2026-01-14T00:02:10.769Z","avatar_url":"https://github.com/fyyb.png","language":"PHP","readme":"# Fyyb Express\n\n\u003e PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.\n\n## Getting started\n\n### Installation\n\nAssuming you already have composer knowledge, create a directory to store your application and make it your working directory.\n\n```\n$ composer require fyyb/express\n```\n\nThis will include in composer autoload all the necessary dependencies.\nRequires PHP 7.0 or later!\n\n### Usage example\n\nAfter installing, create the .htacces, config.php and index.php files at the root of your project.\n\nTo keep your code separate from the configuration files, we suggest that you use a folder/file structure similar to the one below:\n\n```\n   .\n   ├─ App/\n   │    └── ...\n   ├─ vendor/\n   │    └── ...\n   ├─ .htaccess\n   ├─ config.php\n   ├─ index.php\n   └─ composer.json\n```\n\nDon't forget to add your application's namespace in the autoload of the composer.json.\n\n```json\n    \"autoload\": {\n        \"psr-4\": {\n            \"App\\\\\": \"App/\"\n        }\n    },\n```\n\n### .htaccess\n\nTo use fyyb/express, it is necessary to redirect all navigation to the root file (index.php), where all traffic must be handled.\nThe example below shows how:\n\n```\nRewriteEngine On\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteRule ^(.*)$ index.php [QSA]\n```\n\n### config.php\n\nFile where the variables/constants of the project will be defined.\nIf your project directory is different from the root, configure the BASE_DIR constant for the correct operation in identifying the routes.\n\n```php\n\u003c?php\n\n    const BASE_DIR = '/ path / to / project /';\n\n    ...\n\n```\n\n## Hello world\n\nSee how easy it is, in your index.php, insert the code below:\n\n```php\n\u003c?php\n\n    require __DIR__ . \"/config.php\";\n    require __DIR__ . \"/vendor/autoload.php\";\n\n    use Fyyb\\Router;\n    use Fyyb\\Request;\n    use Fyyb\\Response;\n\n    $app = Router::getInstance();\n\n    $app-\u003eget('/', function(Request $req, Response $res) {\n        $res-\u003esend('Hello World!');\n    });\n\n    $app-\u003erun();\n```\n\nThis app responds with \"Hello, world!\" for requests to the root URL (/) or route. For all other paths, it will respond with a 404 not found.\n\n## Simple routing\n\nRouting refers to determining how an application responds to a client request to a particular endpoint, which is a URI (or path) and a specific HTTP request method (GET, POST, and so on).\n\nEach route can have one or more handler functions, which are executed when the route is matched.\n\nRoute definition takes the following structure:\n\n```\n    $app-\u003eMETHOD(PATH, HANDLER)\n```\n\nWhere:\n\n-   \\$app is an instance of fyyb/express.\n-   METHOD is an HTTP request method, in lowercase.\n-   PATH is a path on the server.\n-   HANDLER is the function executed when the route is matched.\n\nThe following examples illustrate defining simple routes.\nRespond with Hello World! on the homepage:\n\n```php\n    $app-\u003eget('/', function (Request $req, Response $res) {\n        $res-\u003esend('Hello World!');\n    });\n```\n\nRespond to POST request on the root route (/), the application’s home page:\n\n```php\n    $app-\u003epost('/', function (Request $req, Response $res) {\n        $res-\u003esend('Got a POST request');\n    });\n```\n\nRespond to PUT request on the root route (/), the application’s home page:\n\n```php\n    $app-\u003eput('/', function (Request $req, Response $res) {\n        $res-\u003esend('Got a PUT request');\n    });\n```\n\nRespond to DELETE request on the root route (/), the application’s home page:\n\n```php\n    $app-\u003edelete('/', function (Request $req, Response $res) {\n        $res-\u003esend('Got a DELETE request');\n    });\n```\n\nRespond to a GET, POST, PUT and DELETE request to the /user route:\n\n```php\n    $app-\u003eany('/user', function (Request $req, Response $res) {\n        $res-\u003esend('Got a GET, POST, PUT and DELETE request at /user');\n    });\n```\n\nOr customize the methods with map function\n\n```\n    $app-\u003emap([METHOD], PATH, HANDLER)\n```\n\nWhere:\n\n-   \\$app is an instance of fyyb/express.\n-   map is a routing function.\n-   [METHOD] is an array of HTTP request methods.\n-   PATH is a path on the server.\n-   HANDLER is the function performed when the route is matched.\n\nRespond to a GET and POST request to the /test route:\n\n```php\n    $app-\u003emap(['GET', 'POST'], '/test', function (Request $req, Response $res) {\n        $res-\u003esend('Got a GET and POST request at /test');\n    });\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffyyb%2Fexpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffyyb%2Fexpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffyyb%2Fexpress/lists"}