{"id":18091244,"url":"https://github.com/jwheare/borax","last_synced_at":"2025-07-16T13:09:39.284Z","repository":{"id":1310003,"uuid":"1253490","full_name":"jwheare/Borax","owner":"jwheare","description":"PHP web framework","archived":false,"fork":false,"pushed_at":"2012-03-12T21:52:44.000Z","size":1543,"stargazers_count":11,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T05:53:35.881Z","etag":null,"topics":[],"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/jwheare.png","metadata":{"files":{"readme":"README","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":"2011-01-14T05:23:58.000Z","updated_at":"2017-11-13T14:01:44.000Z","dependencies_parsed_at":"2022-07-06T20:04:38.515Z","dependency_job_id":null,"html_url":"https://github.com/jwheare/Borax","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwheare%2FBorax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwheare%2FBorax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwheare%2FBorax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwheare%2FBorax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwheare","download_url":"https://codeload.github.com/jwheare/Borax/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670502,"owners_count":21142901,"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":[],"created_at":"2024-10-31T18:11:03.100Z","updated_at":"2025-04-13T05:53:41.400Z","avatar_url":"https://github.com/jwheare.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"HELLO WORLD:\n\n// app/route.class.php\n\u003c?php\n\nnamespace App;\n\nclass Route {\n    static function getPatterns () {\n        return array(\n            '/^$/' =\u003e 'home',\n        );\n    }\n}\n\n// app/controller\n\u003c?php\n\nnamespace App\\Controller;\nuse Core\\Controller;\n\nclass HomeHtml extends Controller\\Html {\n    public function index () {\n        $this-\u003etitle = \"My First Borax Page\";\n        $this-\u003emessage = \"Hello World\";\n        return $this-\u003eresponse;\n    }\n}\n\n// app/template/home/index.tpl.php\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003ctitle\u003e\u003c?php out($this-\u003etitle); ?\u003e\u003c/title\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n        \u003c?php out($this-\u003emessage); ?\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n\nNow install apache-vhost.conf, fix the paths, restart apache and go!\n\nARCHITECTURE:\n\n1. Apache rewrites all URLs to public/index.php\n2. index.php creates a web app runner (Core\\Web) and calls handleRequest();\n3. App runner a) creates a dispatcher (Core\\Dispatcher) with the app (App\\Route) and base url routes\n              b) encapsulates the HTTP request $request (Core\\Request)\n              c) encapsulates a user session (App\\Session) and injects it into the request\n              d) calls processRequest($request) on the dispatcher\n4. Dispatcher maps the request to a controller (App\\Controller) and calls generateResponse() on it\n5. Controller either a) renders a template and returns a response (Core\\Response)\n                  or b) throws an error or redirect (Core\\HttpStatus)\n6. Dispatcher returns a response (Core\\Response), converting error or redirect if needed first.\n7. App runner calls respond() on the response.\n8. Response sets headers and echos output.\n\nFILE OVERVIEW:\n\napache-vhost.conf               // apache virtualhost configuration\n\nstub/                           // Minimal stub app\n\napp/                            // Full example app\n|\n|-- conf/                       // Conf\n|   --- conf.php                // global conf\n|   --- local.conf.php          // local host specific conf. rename this to your system hostname, followed by \".conf.php\"\n|\n|-- controller/                 // Controllers\n|   --- home.controller.php     // GET /                  - home page\n|   --- signout.controller.php  // GET /signout           - deletes session cookie and throws a redirect\n|   --- twitter.controller.php  // GET /twitter/start     - throws a redirect to start twitter oauth process\n|                               // GET /twitter/callback  - handles twitter oauth callback, signs in, redirects\n|\n|-- init.php                    // App setup/service registration\n|\n|-- lib/                        // Lib directory on include path for app specific libs\n|   --- date.class.php          // Misc date helpers\n|\n|-- model/                      // Models\n|   --- person.class.php        // Person database model\n|\n|-- route.class.php             // Url routes\n|\n|-- schema/                     // Model database schemas\n|   --- person.mysql.sql        // Person table schema\n|\n|-- script/                     // Script classes that extend Core\\Script\n|-- twitterinfo.class.php       // Looks up twitter user info, optionally authenticated with a user, or manual credentials\n|\n|-- service/                    // Services\n|   --- db.service.php          // mysql database\n|   --- memcache.service.php    // memcache client\n|   --- memcached.service.php   // memcached client (alternate)\n|\n|-- session.class.php           // User sessions\n|\n|-- template/                   // Templates\n|   --- error.tpl.php           // http errors\n|   --- footer.inc.tpl.php      // global footer\n|   --- header.inc.tpl.php      // global header\n|   --- home/\n|       --- index.tpl.php       // home page\n|   --- _page/                  // page templates with no controller\n|       --- about.tpl.php       // about page\n\nscript/                         // script runners\n|-- twitterinfo.php             // runs the app script class\n|-- initdb.php                  // runs the core script class\n\nutil.php                        // global php helper functions\n\ncore/                           // Core framework classes\n|\n|-- controller/                 // Abstract controllers\n|   --- base.class.php          // Base\n|   --- form.class.php          // Form (POST) -\u003e must redirect\n|   --- html.class.php          // HTML (GET)\n|   --- json.class.php          // Base JSON\n|   --- jsondelete.class.php\n|   --- jsonget.class.php\n|   --- jsonpost.class.php\n|   --- jsonput.class.php\n|   --- page.class.php          // Static html page (GET)\n|   --- shared.class.php        // Shared logic\n|\n|-- db.class.php                // PDO wrapper\n|\n|-- dispatcher.class.php        // Maps urls to controllers, passing in request objects and returning responses\n|\n|-- dump.class.php              // Debug dump helper\n|\n|-- email.class.php             // mb_send_mail wrapper with templating. \n|                               // writes to mail.log instead of sending if define(DISABLE_EMAILS, true);\n|\n|-- httprequest.class.php       // curl wrapper\n|\n|-- httpstatus/                 // HTTP status classes\n|   --- base.class.php\n|   --- baseerror.class.php\n|   --- baseredirect.class.php\n|   --- ...                     // Individual status classes\n|\n|-- model.class.php             // ORM\n|\n|-- relationshipcache.class.php // Foreign key lookup cache\n|\n|-- request.class.php           // Incoming HTTP request wrapper\n|                               // Wraps $_GET $_POST $_COOKIE and $_SERVER\n|\n|-- response/                   // Response classes\n|   --- base.class.php\n|   --- html.class.php\n|   --- htmlerror.class.php\n|   --- json.class.php\n|   --- jsonerror.class.php\n|   --- redirect.class.php\n|\n|-- script.class.php            // Script class, with helpers for handling command line args\n|-- initdbscript.class.php      // Creates a new database and username\n|\n|-- servicemanager.class.php    // Static global services manager\n|\n|-- session.class.php           // Base Session class. Wraps $_SESSION. Manages cache headers\n|\n|-- twitter.class.php           // Twitter API client\n|\n|-- url.class.php               // URL encoding, building, parsing class\n|\n|-- web.class.php               // Web app runner\n\ninit.php                        // Framework initialisation\n\n# Web document root\n\npublic/                         // Put non static and non framework files in here\n|-- index.php                   // Delegates to web app runner\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwheare%2Fborax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwheare%2Fborax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwheare%2Fborax/lists"}