{"id":23619154,"url":"https://github.com/nabeelalihashmi/nthphp","last_synced_at":"2026-02-26T03:07:51.087Z","repository":{"id":269340493,"uuid":"907105423","full_name":"nabeelalihashmi/NthPHP","owner":"nabeelalihashmi","description":"Lightning Fast PHP Framework","archived":false,"fork":false,"pushed_at":"2025-03-05T13:14:46.000Z","size":2787,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T20:11:44.520Z","etag":null,"topics":["php","php-framework","php-routing","php-routing-library","skeleton"],"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/nabeelalihashmi.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-12-22T20:28:57.000Z","updated_at":"2025-03-05T13:14:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2b2b4c2-7ca3-42fe-b6fb-7ad7866d248e","html_url":"https://github.com/nabeelalihashmi/NthPHP","commit_stats":null,"previous_names":["nabeelalihashmi/nthphp"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeelalihashmi%2FNthPHP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeelalihashmi%2FNthPHP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeelalihashmi%2FNthPHP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeelalihashmi%2FNthPHP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nabeelalihashmi","download_url":"https://codeload.github.com/nabeelalihashmi/NthPHP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085280,"owners_count":21045138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","php-framework","php-routing","php-routing-library","skeleton"],"created_at":"2024-12-27T19:47:41.260Z","updated_at":"2026-02-26T03:07:46.037Z","avatar_url":"https://github.com/nabeelalihashmi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NthPHP Framework\n\nNthPHP is a fast, optimized PHP framework designed to speed up and simplify web development using automatic routing and providing great developer experience. Not only it can run in a traditional PHP environment with **Apache**, **Nginx**, **LiteSpeed**, or any other similar web server, but also it provides high performance, leveraging **Swoole** for asynchronous, coroutine-based processing, allowing your application to handle thousands of requests concurrently without requiring any changes in code.\n\n\u003cimg src=\"public/logo.png\" width=\"100\"\u003e\n\n## Installation\n\nDownload this repo or clone this repo or run following command:\n\n```\ncomposer create-project nabeelalihashmi/nthphp app_name\n```\n\n## Screenshots\n\n![](screenshots/1.png)\n![](screenshots/2.png)\n![](screenshots/3.png)\n\n\n\nBuilt around a clean and minimal architecture, NthPHP uses PHP attributes for routing, automatic routing for Blade views, a flexible Blade templating engine for views, and a powerful ORM (RedBeanPHP) for database access. With built-in support for middleware and an easy-to-use configuration system, it simplifies common tasks like request handling, email sending, and validation.\n\n## Key Features\n\n- **Fast \u0026 Optimized**: NthPHP is built for speed, providing an efficient routing system and optimized performance.\n- **PHP Attributes for Routing**: Routes are defined using PHP attributes, allowing for a clean, modern approach to routing.\n- **Automatic Routing**: Routes are automatically collected from controllers, reducing the need for manual route registration.\n- **Blade Templating**: Uses **BladeOne** as the templating engine, with automatic routes generation from views stored in a specific folder (`/app/Views/_pages`).\n- **RedBeanPHP**: Uses **RedBeanPHP** for database interactions. No need for models, but models can be used if desired.\n- **Swoole Integration**: NthPHP can utilize **Swoole** for asynchronous, coroutine-based performance, dramatically improving scalability and handling of concurrent requests. It can run in **Swoole** for better performance without changing the core code base.\n- **Compatibility with Apache/Nginx/LiteSpeed**: NthPHP is fully compatible with traditional web servers like **Apache**, **Nginx**, and **LiteSpeed**. Whether you deploy on **Swoole** for concurrency and performance boosts or use a traditional web server, the same code works seamlessly across all environments, making the framework extremely flexible.\n\n## Configuration\n\nThe configuration is stored in `app/config.php` and includes settings for routing, controllers, views, server config etc. NthPHP provides a class `Config` to read the config with dot notation, with `Config::get` method to read the configuration.\n\n```\n    $baseUrl = Config::get('app.base_url');\n```\n\n### Automatic Views Directory\n\nThe framework uses **Blade** templating with the default directory for views located at `/app/Views`.\n\nIn routing, if `automatic_routes` have value other than `false`, e.g,\n```\n    'automatic_routes' =\u003e ['_pages', '_other_dir_in_views' ]\n```\nthen blade view files in  `/app/Views/_pages` and `_other_dir_in_views`, are considered as routes.\n\n## Manual Routes\n\nIt is possible to define own routes in `app/Routes` directory. A php file here, must return an array of route arrays. A route array has following keys:\n\n-**method**  \n-**path**  \n-**handler**  \n-**middleware**  \n\nCheck demo files for example.\n\nIf file name is root.php, then routes of that and mounted with group. For other name, such as `demos.php`, any route define in it will automatically prepend `demos` in routes. \n\n## Documentation\n\n- **Blade**: [Laravel Blade Documentation](https://laravel.com/docs/8.x/blade)\n- **BladeOne**: [BladeOne GitHub Repository](https://github.com/EFTEC/BladeOne)\n- **RedBeanPHP**: [RedBeanPHP Documentation](https://redbeanphp.com/)\n\n## Installation\n\n1. Clone the repository or download the framework.\n2. Run `composer install` to install the required dependencies.\n3. Configure your database and other settings as needed.\n4. Start developing your application by creating controllers and views.\n\n## Usage\n\n1. Define routes in your controllers using PHP attributes.\n\n```\n#[Route(method, uri, middleware)]\n\n#[Route(['GET', 'POST'], '/user/{name}', [AuthMiddleware::class])]\n\n```\n\n2. Views in `app/views/_pages` are automatically rendered based on routes, with Blade templating.\n\n3. Database interactions can be handled using **RedBeanPHP**, with or without models.\n\n4. The framework can run on **Swoole**, **Apache**, **Nginx**, **LiteSpeed**, or any other similar server environment without any changes to your code.\n\n```\nphp server.php\n```\n\n## Caching\n\nPlease note that when routes are changed, and caching is set to true in the config, please delete `cache/routes/collector.cache` and `cache/routes/routes.cache` files.\n\n## Developer\n\nThis framework is developed by **Nabeel Ali**. You can connect with the developer on LinkedIn:\n\n- [Nabeel Ali](https://linkedin.com/in/nabeelalihashmi)\n- Co-Founder and Creator of [Aliveforms]('https://aliveforms.com')\n- Founder and Creator [Quizrella]('https://quizrella.com')\n\n---\n\nThis is just the beginning. NthPHP is a work in progress and continuously evolving.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabeelalihashmi%2Fnthphp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnabeelalihashmi%2Fnthphp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabeelalihashmi%2Fnthphp/lists"}