{"id":44855539,"url":"https://github.com/modulusphp/upstart","last_synced_at":"2026-02-17T07:54:24.087Z","repository":{"id":57018904,"uuid":"227551705","full_name":"modulusphp/upstart","owner":"modulusphp","description":"The service that start's your Modulus application","archived":false,"fork":false,"pushed_at":"2019-12-28T07:00:19.000Z","size":116,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-04T08:23:11.037Z","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/modulusphp.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}},"created_at":"2019-12-12T07:59:27.000Z","updated_at":"2024-04-04T08:23:11.037Z","dependencies_parsed_at":"2022-08-22T20:31:00.410Z","dependency_job_id":null,"html_url":"https://github.com/modulusphp/upstart","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/modulusphp/upstart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modulusphp%2Fupstart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modulusphp%2Fupstart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modulusphp%2Fupstart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modulusphp%2Fupstart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/modulusphp","download_url":"https://codeload.github.com/modulusphp/upstart/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modulusphp%2Fupstart/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29536934,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T05:00:25.817Z","status":"ssl_error","status_checked_at":"2026-02-17T04:57:16.126Z","response_time":100,"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":[],"created_at":"2026-02-17T07:54:23.349Z","updated_at":"2026-02-17T07:54:24.075Z","avatar_url":"https://github.com/modulusphp.png","language":"PHP","readme":"# Modulus Upstart Component\n\nThis component is responsible for starting Craftsman and your Modulus Application.\n\nInstall\n-------\n\nThis package will be automatically installed with the Modulus Framework.\n\n\u003e Note: Upstart is not configured in older versions of Modulus\n\n```\ncomposer require modulusphp/upstart\n```\n\nConfigure\n-------\n\nTo get started, add a `app.php` file in the bootstrap directory, with the following content:\n\n```php\n\u003c?php\n\n/*\n|--------------------------------------------------------------------------\n| Register The Auto Loader\n|--------------------------------------------------------------------------\n|\n| Composer has classes that we need to get our application running, all\n| we need to do is just load it onto our script and we should be good to\n| go!\n|\n*/\n\nrequire __DIR__. '/../vendor/autoload.php';\n\n/*\n|--------------------------------------------------------------------------\n| Craft The Application\n|--------------------------------------------------------------------------\n|\n| We first need to create a new instance of the application. Modulus\n| will configure services that are needed by the rest of the application\n| for you.\n|\n*/\n\n$app = Modulus\\Upstart\\Application::boot(realpath(__DIR__ . '/../'));\n\n$app-\u003emake(new Modulus\\Upstart\\Boot\\BugsnagHandler);\n\n$app-\u003emake(new Modulus\\Upstart\\Boot\\WhoopsHandler);\n\n$app-\u003emake(new Modulus\\Upstart\\Boot\\EloquentHandler);\n\n$app-\u003emake(\n  new Modulus\\Upstart\\Boot\\ApplicationServices([\n    'httpFoundation' =\u003e App\\Http\\HttpFoundation::class,\n    'handler' =\u003e App\\Exceptions\\Handler::class,\n    'routerResolver' =\u003e App\\Resolvers\\RouterResolver::class,\n    'appServiceResolver' =\u003e App\\Resolvers\\AppServiceResolver::class\n  ])\n);\n\n/*\n|--------------------------------------------------------------------------\n| Return The Application\n|--------------------------------------------------------------------------\n|\n| Once the services have been loaded in the config, we will then return\n| the instance of the application.\n|\n*/\n\nreturn $app;\n```\n\nMake sure the following classes, extend:\n\nClass | Extend\n:------|:--------\n`App\\Http\\HttpFoundation::class` | `Modulus\\Http\\Kernel::class`\n`App\\Exceptions\\Handler::class` | `Modulus\\Upstart\\Exceptions\\Handler::class`\n`App\\Resolvers\\RouterResolver::class` | `Modulus\\Upstart\\Resolvers\\Router\\Service::class` \n`App\\Resolvers\\AppServiceResolver::class` | `Modulus\\Upstart\\Service::class`\n\nNow, head over to `public/index.php` and replace the contents with:\n\n```php\n\u003c?php\n\n/**\n * Modulus - A cool API Framework for PHP\n *\n * @package Modulus\n * @author  Donald Pakkies \u003cdonaldpakkies@gmail.com\u003e\n */\n\ndefine('MODULUS_START', microtime(true));\n\n/*\n|--------------------------------------------------------------------------\n| Turn On The Lights\n|--------------------------------------------------------------------------\n|\n| Before we can run the application, we will need to get it from the\n| bootstrap, after getting it, we will be able to build a response and\n| send it back to the browser.\n|\n*/\n\n$app = require('../bootstrap/app.php');\n\n/*\n|--------------------------------------------------------------------------\n| Run The Application\n|--------------------------------------------------------------------------\n|\n| Now that we have required the application and have added our configs,\n| we can send a response back to the browser. To get the response, we\n| basically just need to pass our application instance to the response\n| make method. So let's try it and see what we get!\n|\n*/\n\nreturn Modulus\\Upstart\\Response::make($app);\n```\n\nOnce that has been done, update `craftsman`:\n\n```php\n#!/usr/bin/env php\n\u003c?php\n\n/**\n * Modulus - A cool API Framework for PHP\n *\n * @package  Modulus\n * @author   Donald Pakkies \u003cdonaldpakkies@gmail.com\u003e\n */\n\ndefine('MODULUS_START', microtime(true));\n\n/*\n|--------------------------------------------------------------------------\n| Turn On The Lights\n|--------------------------------------------------------------------------\n|\n| Before we can run the application, we will need to get it from the\n| bootstrap, after getting it, we will be able to build a response and\n| send it back to the browser.\n|\n*/\n\n/** @var \\Modulus\\Upstart\\Application $app */\n$app = require('bootstrap/app.php');\n\n/*\n|--------------------------------------------------------------------------\n| Register Craftsman\n|--------------------------------------------------------------------------\n|\n| Since we are running our application through the cli, we need to\n| register a couple of commands so they can be used through the terminal.\n| To get started, we just need to pass our kernel class to the console\n| method. And that's pretty much it!\n|\n*/\n\n$app-\u003econsole(App\\Console\\Kernel::class);\n\n/*\n|--------------------------------------------------------------------------\n| Run Craftsman\n|--------------------------------------------------------------------------\n|\n| To get craftsman to run, we just need to pass it to the response make\n| make method, \"make\" will return a response back to the terminal. So\n| let's see if this works.\n|\n*/\n\nreturn Modulus\\Upstart\\Response::make($app);\n```\n\nAnd that's it, your application is ignited!.\n\n### Making everything work\n\nSince we are replacing the old Framework core with `upstart`, we need to make sure our code base has the necessary code. \n\n#### App Service\n\n```php\n\u003c?php\n\nnamespace App\\Resolvers;\n\nuse Modulus\\Upstart\\Service;\n\nclass AppServiceResolver extends Service\n{\n  /**\n   * Register application services\n   *\n   * @return void\n   */\n  protected function boot() : void\n  {\n    //\n  }\n}\n```\n\n#### Routes Service\n\n```php\n\u003c?php\n\nnamespace App\\Resolvers;\n\nuse Modulus\\Upstart\\Resolvers\\Router\\Service;\n\nclass RouterResolver extends Service\n{\n  /**\n   * Redirect route after authentication\n   *\n   * @var string\n   */\n  public const HOME = '/';\n\n  /**\n   * Register application routes\n   *\n   * @return void\n   */\n  protected function boot() : void\n  {\n    $this-\u003eapiRoutes();\n    $this-\u003ewebRoutes();\n  }\n\n  /**\n   * Load api routes\n   *\n   * @param object $app\n   * @return void\n   */\n  protected function apiRoutes() : void\n  {\n    $this-\u003eroute-\u003emake(base_path('routes/api.php'))\n        -\u003emiddleware('api')\n        -\u003eprefix('api')\n        -\u003eregister();\n  }\n\n  /**\n   * Load web routes\n   *\n   * @return void\n   */\n  protected function webRoutes() : void\n  {\n    $this-\u003eroute-\u003emake(base_path('routes/web.php'))\n        -\u003emiddleware('web')\n        -\u003eregister();\n  }\n}\n```\n\nSecurity\n-------\n\nIf you discover any security related issues, please email donaldpakkies@gmail.com instead of using the issue tracker.\n\nLicense\n-------\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodulusphp%2Fupstart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodulusphp%2Fupstart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodulusphp%2Fupstart/lists"}