{"id":18782895,"url":"https://github.com/jijihohococo/ichi-template","last_synced_at":"2026-02-22T22:49:08.836Z","repository":{"id":56999007,"uuid":"450030110","full_name":"jijihohococo/ichi-template","owner":"jijihohococo","description":"PHP Template Library","archived":false,"fork":false,"pushed_at":"2025-09-22T11:34:53.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-22T12:17:28.540Z","etag":null,"topics":["library","open-source","php","php-library","php-template","pure-php"],"latest_commit_sha":null,"homepage":"","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/jijihohococo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-01-20T09:21:04.000Z","updated_at":"2025-09-22T11:34:55.000Z","dependencies_parsed_at":"2025-04-14T13:32:50.146Z","dependency_job_id":null,"html_url":"https://github.com/jijihohococo/ichi-template","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"929dcc6e3f13c3536bf08a931bb91e40691121e6"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/jijihohococo/ichi-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jijihohococo%2Fichi-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jijihohococo%2Fichi-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jijihohococo%2Fichi-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jijihohococo%2Fichi-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jijihohococo","download_url":"https://codeload.github.com/jijihohococo/ichi-template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jijihohococo%2Fichi-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29730142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T20:09:16.275Z","status":"ssl_error","status_checked_at":"2026-02-22T20:09:13.750Z","response_time":110,"last_error":"SSL_read: 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":["library","open-source","php","php-library","php-template","pure-php"],"created_at":"2024-11-07T20:37:24.087Z","updated_at":"2026-02-22T22:49:08.818Z","avatar_url":"https://github.com/jijihohococo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ICHI PHP TEMPLATE\n\nICHI PHP TEMPLATE is the fast and secure Pure PHP Template Library\n\n## License\n\nThis package is Open Source According to [MIT license](LICENSE.md)\n\n## Table Of Contents\n\n- [ICHI PHP TEMPLATE](#ichi-php-template)\n\t- [License](#license)\n\t- [Table Of Contents](#table-of-contents)\n\t\t- [Acknowledgement](#acknowledgement)\n\t\t- [Installation](#installation)\n\t\t- [Set Up Template Base Directory Path](#set-up-template-base-directory-path)\n\t\t- [Showing Views](#showing-views)\n\t\t- [Showing Error Messages](#showing-error-messages)\n\t\t- [Showing Success Messages](#showing-success-messages)\n\t\t- [Section And Content](#section-and-content)\n\t\t- [Sharing Data In All Views](#sharing-data-in-all-views)\n\t\t- [Preventing XSS Attack](#preventing-xss-attack)\n\t\t- [Components](#components)\n\t- [Show Old Request Data](#show-old-request-data)\n\n### Acknowledgement\n\nI really thanks to my mother for everything. She is the best for me.\n\n### Installation\n\n```php\n\ncomposer require jijihohococo/ichi-template\n\n```\n\n### Set Up Template Base Directory Path\n\nYou can set up the base directory path for your all template view files.\n\n\u003cb\u003eIt is highly recommend to set up template base directory path before using functions of ICHI TEMPLATE\u003c/b\u003e\n\n\u003cb\u003eThe base directory path will be used in calling all views\u003c/b\u003e\n\n```php\n\nuse JiJiHoHoCoCo\\IchiTemplate\\Template\\View;\n\n// example //\n\nView::setPath(__DIR__.'/../views/');\n\n```\n\nIt doesn't matter if you want to use another base directory path name.\n\nAfter setting template base path for views, you can directly call the files under this base path directly.\n\nFor example,you have 'show_data.php' under your template base path.\n\nYou can directly call this file in showing views directly without including directory path if you had set template base path.\n\n\n### Showing Views\n\nYou can show the views in your function like that\n\n\u003cb\u003eYou must include full directory path if you don't set up the template base path\u003c/b\u003e\n\n\u003cb\u003eUsing 'view' function can only apply section and content template style in that called view php file.\u003c/b\u003e\n\n\n\u003ci\u003eWithout Data\u003c/i\u003e\n\n```php\n\npublic function showData(){\n\t//\n\treturn view('show_data.php');\n}\n\n```\n\u003ci\u003eWith Data\u003c/i\u003e\n\n```php\n\npublic function showData(){\n\treturn view('show_data.php',[\n\t\t'data' =\u003e 'Hello World'\n\t]);\n}\n\n```\n\n\u003cb\u003eYou can also call your php file without '.php' file extension\u003c/b\u003e\n\n```php\n\npublic function showData(){\n\n\treturn view('show_data');\n}\n\n```\n\nYou can use called data in your view file which is calling from \"view\" function\n\n\u003ci\u003eIn your_view_php_file_path\u003c/i\u003e\n```php\n\necho $data; // Hello World\n\n```\nIf you don't want to use template system but want to show only the views. You can do as shown as below\n\nYou can also use following functions within your view php file which is called from 'view' function\n\n\u003ci\u003eWithout Data\u003c/i\u003e\n\n```php\n\nincludeView('include_file.php');\n\n```\n\n\u003ci\u003eWith Data\u003c/i\u003e\n\n```php\n\nincludeView('include_file.php',[\n\t'data' =\u003e 'Hello World'\n]);\n\n```\n\n\u003cb\u003eYou can also call your php file without '.php' file extension\u003c/b\u003e\n\n```php\n\nincludeView('include_file');\n\n```\n\n'includeView' function will show the file by using 'include' function\n'includeOnceView' function will show the by using 'include_once' function \n'requireView' function will show the file by using 'require' function\n'requireOnceView' function will show the file by using 'require_once' function\n\n### Showing Error Messages\n\nYou can add error messages\n\n```php\n\nsetErrors([\n\t'name_error' =\u003e 'name is required',\n\t'email_error' =\u003e 'email is required'\n]);\n\n```\n\nYou can get error messages with 'errors' array variable in your view php files\n\n```php\nif(isset($errors['name_error'])){\n\necho $errors['name_error']. '\u003cbr\u003e';\n\n}\n\nif(isset($errors['email_error'])){\n\necho $errors['email_error'] . '\u003cbr\u003e';\n\n}\n```\n\n### Showing Success Messages\n\nYou can add success messages\n\n```php\n\nsetSuccess([\n\t'message' =\u003e 'registeration is completed'\n]);\n```\nYou can get sucess messages with 'success' array variable in your view php views\n\n```php\n\nif(isset($success['message'])){\n\necho $success['message'];\n\n}\n```\n\n### Section And Content\n\nYou can apply template system as shown as below\n\nFirstly, you must show your view php file\n\n```php\n\nreturn view('show_data.php');\n\n```\n\n\u003ci\u003eIn your template main php file\u003c/i\u003e\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n\t\u003cmeta charset=\"utf-8\"\u003e\n\t\u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\n\u003c?php y('content'); ?\u003e\n\n\u003c?php includeView('admin/layouts/footer.php'); ?\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n\u003ci\u003eIn your view php file\u003c/i\u003e\n```html\n\u003c?php\n\nextend('main.php'); \nsection('content');\n?\u003e\n\n\u003cp\u003eContent\u003c/p\u003e\n\n\u003c?php endSection(); ?\u003e\n```\n\n\u003cb\u003eYou can also call your php file without '.php' file extension\u003c/b\u003e\n\n```php\n\nextend('main');\n\n```\n\n\nIn your view php file, You must call your template main php file with 'extend' function firstly.\nYou must add 'content' name in your 'section' function.\nAfter using 'section' function and write your frontend stuffs you must use 'endSection' function\n\nIn your template main php file, you must call 'y' function with the content name that you want to show.\n\nBoth view php file and main layout file will be shown.\n\nIf you want to change page title dynamicatlly according to view php file\n\n\u003ci\u003eIn your view php file\u003c/i\u003e\n\n```php\n\nsection('content','Content Page');\n\n```\n\n\u003ci\u003eIn your template main php file\u003c/i\u003e\n\n```html\n\u003chead\u003e\n\t\u003ctitle\u003e\u003c?php echo title(); ?\u003e\u003c/title\u003e\n\u003c/head\u003e\n```\n\n### Sharing Data In All Views\n\nYou can share the data (variables) in all your views\n\n```php\n\nuse JiJiHoHoCoCo\\IchiTemplate\\Template\\View;\n\nView::share([\n'writer' =\u003e 'John',\n'book' =\u003e 'New Book' \n]);\n\n```\n\nAnd calling 'view' function\n\n```php\n\nreturn view('show_data.php');\n\n```\n\nYou can use the share data as variables in your view php file\n\n```php\n\necho $writer . '\u003cbr\u003e';\necho $book;\n\n\n```\n### Preventing XSS Attack\n\nYou can prevent your string data output from xss attack\n\n```php\n\necho e($data);\n\n```\n\n### Components\n\nYou can use class as your component to show view php files\n\n\u003ci\u003eIn your component class\u003c/i\u003e\n\n```php\n\nnamespace App\\Components;\nuse JiJiHoHoCoCo\\IchiTemplate\\Component\\Component;\n\n\nclass TestComponent extends Component{\n\n\tpublic function render(){\n\t\treturn view('componet_view.php');\n\t}\n}\n\n```\n\nYou can create the component class with the commandline.\n\nFirstly you need to created the file named \"ichi\" under your project folder and use the below code in this file\n\n```php\n#!/usr/bin/env php\n\u003c?php\n\nrequire __DIR__.'/vendor/autoload.php';\n\nuse JiJiHoHoCoCo\\IchiTemplate\\Command\\TemplateCommand;\n\n\n$templateCommand=new TemplateCommand;\n$templateCommand-\u003erun(__DIR__,$argv);\n\n```\n\nAnd then you can create the component in your commandline\n\n```php\n\nphp ichi make:component TestComponent\n\n```\n\nThe default file folder is \"app/Components\". So after making command, the component you created will be in the this default file folder. If you want to change the default folder path, you can change it in your \"ichi\" file.\n\n\n```php\n\n$templateCommand = new TemplateCommand;\n$templateCommand-\u003esetPath('new_app/Components');\n$templateCommand-\u003erun(__DIR__,$argv);\n\n```\n\n\u003ci\u003eIn your view php file, you can now call your component\u003c/i\u003e\n\n```php\n\ncomponent('App\\Components\\TestComponent');\n\n```\n\nYou can use constructor in your component class to pass the data\n\n\u003ci\u003eIn your component class\u003c/i\u003e\n\n```php\n\nnamespace App\\Components;\nuse JiJiHoHoCoCo\\IchiTemplate\\Component\\Component;\n\n\nclass TestComponent extends Component{\n\n\tprivate $name;\n\n\tpublic function __construct(string $name){\n\t\t$this-\u003ename=$name;\n\t}\n\n\tpublic function render(){\n\t\treturn view('componet_view.php',[\n\t\t\t'name' =\u003e $this-\u003ename\n\t\t]);\n\t}\n}\n\n```\n\u003ci\u003eIn your view php file\u003c/i\u003e\n\n```php\n\ncomponent('App\\Components\\TestComponent',[\n\t'name' =\u003e 'Test Data'\n]);\n\n```\n\nYou can set the base directory path for your component classes.\n\n```php\n\nuse JiJiHoHoCoCo\\IchiTemplate\\Component\\ComponentSetting;\n\nComponentSetting::setPath('App\\Components');\n\n```\n\nSo you can call only component class name when you use 'component' function\n\n```php\n\ncomponent('TestComponent',[\n\t'name' =\u003e 'Test Data'\n]);\n\n```\n\n## Show Old Request Data\n\nYou can show old request data after submitting in your php file\n\n```html\n\n\u003cinput type=\"text\" name=\"test\" value=\"\u003c?php old('test'); ?\u003e\"\u003e\n\n```\n\nIf you want to set default data if the request is not isset\n\n```php\n\nold('test','Default Test');\n\n```\n\n\u003cb\u003eThis function is aimed to use in create and update data forms.\u003c/b\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjijihohococo%2Fichi-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjijihohococo%2Fichi-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjijihohococo%2Fichi-template/lists"}