{"id":29215525,"url":"https://github.com/mbejda/30-second-introduction-to-codeigniter","last_synced_at":"2026-02-04T14:04:21.410Z","repository":{"id":73404611,"uuid":"43644806","full_name":"mbejda/30-second-Introduction-to-CodeIgniter","owner":"mbejda","description":"30 second introduction to CodeIgniter. We are going configure codeIgniter, create a controller and have it serve our view. ","archived":false,"fork":false,"pushed_at":"2015-10-04T18:30:21.000Z","size":1592,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-08-04T02:00:24.011Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/mbejda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-04T17:17:36.000Z","updated_at":"2023-08-04T02:00:24.012Z","dependencies_parsed_at":"2023-03-01T09:46:26.377Z","dependency_job_id":null,"html_url":"https://github.com/mbejda/30-second-Introduction-to-CodeIgniter","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/mbejda/30-second-Introduction-to-CodeIgniter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbejda%2F30-second-Introduction-to-CodeIgniter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbejda%2F30-second-Introduction-to-CodeIgniter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbejda%2F30-second-Introduction-to-CodeIgniter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbejda%2F30-second-Introduction-to-CodeIgniter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbejda","download_url":"https://codeload.github.com/mbejda/30-second-Introduction-to-CodeIgniter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbejda%2F30-second-Introduction-to-CodeIgniter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263234963,"owners_count":23434922,"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":"2025-07-03T00:10:00.508Z","updated_at":"2026-02-04T14:04:21.313Z","avatar_url":"https://github.com/mbejda.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"![30 second introduction to CodeIgniter](http://www.mbejda.com/content/images/2015/10/codeigniter.png#cover#cover)\n\nThis 30 second series covers the CodeIgniter PHP framework. We are going to install CodeIgniter, create a CodeIgniter controller and a CodeIgniter view. Then we are going to make bind the controller to the view with the router. If you get lost at any step of the way the entire project source code can be found in the following repo https://github.com/mbejda/30-second-Introduction-to-CodeIgniter.\n **Lets get started.**\n\n##Installation\nDownload,fork or clone CodeIgniter frame work from there [repo](https://github.com/bcit-ci/CodeIgniter) and extract the files. The directory structure should look similarly to the following :\n![directory](http://www.mbejda.com/content/images/2015/10/Screen-Shot-2015-10-04-at-1-52-25-PM.png#400). Navigate to the root of the project and run `composer install` to install CodeIgniter dependencies.\n\n\n##Creating A View\nCodeIgniter views are located in `application/views` directory. Navigate to `application/views` and create a new view file. I named my CodeIgniter view file `hello.php`. Paste the following contents into the CodeIgniter view file.\n```\n\u003c?php\ndefined('BASEPATH') OR exit('No direct script access allowed');\n?\u003e\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n\t\u003cmeta charset=\"utf-8\"\u003e\n\t\u003ctitle\u003eWelcome to CodeIgniter\u003c/title\u003e\n\n\t\u003cstyle type=\"text/css\"\u003e\n\n\t::selection { background-color: #E13300; color: white; }\n\t::-moz-selection { background-color: #E13300; color: white; }\n\n\tbody {\n\t\tbackground-color: #fff;\n\t\tmargin: 40px;\n\t\tfont: 13px/20px normal Helvetica, Arial, sans-serif;\n\t\tcolor: #4F5155;\n\t}\n\n\ta {\n\t\tcolor: #003399;\n\t\tbackground-color: transparent;\n\t\tfont-weight: normal;\n\t}\n\n\th1 {\n\t\tcolor: #444;\n\t\tbackground-color: transparent;\n\t\tborder-bottom: 1px solid #D0D0D0;\n\t\tfont-size: 19px;\n\t\tfont-weight: normal;\n\t\tmargin: 0 0 14px 0;\n\t\tpadding: 14px 15px 10px 15px;\n\t}\n\n\tcode {\n\t\tfont-family: Consolas, Monaco, Courier New, Courier, monospace;\n\t\tfont-size: 12px;\n\t\tbackground-color: #f9f9f9;\n\t\tborder: 1px solid #D0D0D0;\n\t\tcolor: #002166;\n\t\tdisplay: block;\n\t\tmargin: 14px 0 14px 0;\n\t\tpadding: 12px 10px 12px 10px;\n\t}\n\n\t#body {\n\t\tmargin: 0 15px 0 15px;\n\t}\n\n\tp.footer {\n\t\ttext-align: right;\n\t\tfont-size: 11px;\n\t\tborder-top: 1px solid #D0D0D0;\n\t\tline-height: 32px;\n\t\tpadding: 0 10px 0 10px;\n\t\tmargin: 20px 0 0 0;\n\t}\n\n\t#container {\n\t\tmargin: 10px;\n\t\tborder: 1px solid #D0D0D0;\n\t\tbox-shadow: 0 0 8px #D0D0D0;\n\t}\n\t\u003c/style\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\n\u003cdiv id=\"container\"\u003e\n\t\u003ch1\u003eWelcome World\u003c/h1\u003e\n\n\n\n\u003c/div\u003e\n\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n\n##Creating A Controller\nCodeIgniters controllers are in the `application/controller` directory. Navigate to `application/controller` and create a new Codeigniter controller file. I named my controller file `Hello.js`. Paste the following code into the controller.\u003cbr\u003e *Make sure that your class name reflects your controller file name and your view matches your views file name.*\n\n```\n\u003c?php\ndefined('BASEPATH') OR exit('No direct script access allowed');\n\nclass Hello extends CI_Controller {\n\n    public function index()\n    {\n        $this-\u003eload-\u003eview('hello');\n    }\n}\n\n```\n##Creating A Route\nRoutes bind controllers to views. CodeIgniters routes are in `application/config/routes.php` file. Open the route file and add the following:\n```\n$route['hello'] = 'hello';\n```\n\nThe `$route['hello']` assigns the necessary URI structure to the `hello` controller.\n\n##Testing It Out\nLets test everything out. Navigate to the project root and launch the application. In the terminal run\u003cbr\u003e\n```\nphp -S localhost:9000\n```\nThen navigate to the URI that has been added to the route. You should see something like this :\n![codigniter hello](http://www.mbejda.com/content/images/2015/10/Screen-Shot-2015-10-04-at-2-15-04-PM.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbejda%2F30-second-introduction-to-codeigniter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbejda%2F30-second-introduction-to-codeigniter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbejda%2F30-second-introduction-to-codeigniter/lists"}