{"id":18307879,"url":"https://github.com/tobihatti/lphp-engine","last_synced_at":"2025-04-09T11:25:09.222Z","repository":{"id":116971778,"uuid":"266369980","full_name":"TobiHatti/LPHP-Engine","owner":"TobiHatti","description":"✔🌍 Minimalistic Layout-Engine for PHP (similar to ASP.Net Razor)","archived":false,"fork":false,"pushed_at":"2020-09-08T22:20:49.000Z","size":101639,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T05:24:54.873Z","etag":null,"topics":["layout-engine","lphp","php","php-extension","preprocessor"],"latest_commit_sha":null,"homepage":"https://endev.at/p/LPHP","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TobiHatti.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-23T15:56:21.000Z","updated_at":"2020-09-08T22:18:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"24f752d5-af9c-456d-b65b-af278b9d0797","html_url":"https://github.com/TobiHatti/LPHP-Engine","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TobiHatti%2FLPHP-Engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TobiHatti%2FLPHP-Engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TobiHatti%2FLPHP-Engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TobiHatti%2FLPHP-Engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TobiHatti","download_url":"https://codeload.github.com/TobiHatti/LPHP-Engine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248029110,"owners_count":21035938,"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":["layout-engine","lphp","php","php-extension","preprocessor"],"created_at":"2024-11-05T16:05:46.980Z","updated_at":"2025-04-09T11:25:09.215Z","avatar_url":"https://github.com/TobiHatti.png","language":"C#","readme":"\u003cimg align=\"right\" width=\"80\" height=\"80\" data-rmimg src=\"https://endev.at/content/projects/LPHP/LPHP_Logo.svg\"\u003e\n\n# LPHP-Engine v1.1.0\n![GitHub](https://img.shields.io/github/license/TobiHatti/LPHP-Engine)\n[![GitHub Release Date](https://img.shields.io/github/release-date-pre/TobiHatti/LPHP-Engine?include_prereleases)](https://github.com/TobiHatti/LPHP-Engine/releases)\n[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/TobiHatti/LPHP-Engine?include_prereleases)](https://github.com/TobiHatti/LPHP-Engine/releases)\n[![GitHub last commit](https://img.shields.io/github/last-commit/TobiHatti/LPHP-Engine)](https://github.com/TobiHatti/LPHP-Engine/commits/master)\n[![GitHub issues](https://img.shields.io/github/issues-raw/TobiHatti/LPHP-Engine)](https://github.com/TobiHatti/LPHP-Engine/issues)\n[![GitHub language count](https://img.shields.io/github/languages/count/TobiHatti/LPHP-Engine)](https://github.com/TobiHatti/LPHP-Engine)\n\n![image](https://endev.at/content/projects/LPHP/LPHP_Banner_300.png)\n\nThe LPHP-Engine (Layout-Based PHP-Engine) provides a minimalistic Layout-Engine for PHP. Based on the Layout-features of the ASP.NET Razor framework. \nThis allows you to create PHP-Based Websites with layouts, similar to Razor, without the need of a webserver that supports ASP.Net Websites.\n\n## Features\n\n- Layout features similar to ASP.Net Razor in PHP\n- Defining and calling local and global variables\n- Defining page layouts with just a few lines of code\n- Automatic conversion from .lphp files to php-files with debug-information\n\n## Syntax\n\n### LPHP-Instruction-Block\nLPHP-Instructions must be placed inside a LPHP-Instruction-Block at the very beginning of the lphp-file:\n```php\n$${\n  // LPHP-Instruction-Block\n}\n\u003c!-- Everything after the LPHP-Instruction-Block will be interpreted as default HTML+PHP --\u003e\n\u003chtml\u003e\n\u003chead\u003e\n  \u003c?php ...\n```\n\nInside this block you can declare variables, set compiler-flags or set the layout.\n\n### Creating variables\n\nTypes of variables:\n- Local variables: can be accessed by the declaring file, \nas well as all files that get called or have been called from this file\n- Global variables: can be accessed by any file in the project-folder\n\n```php\n$${\n  set MyVariable1 = \"SampleText\";     // Create local variable \"MyVariable1\" with string\n  set MyVariable2 = 12345;            // Create local variable \"MyVariable2\" with decimal\n  set MyVariable3 = true;             // Create local variable \"MyVariable2\" with boolean\n  \n  glob GlobalVariable1 = \"SampleText\"; // Create global variable \"GlobalVariable1\" with string\n  glob GlobalVariable2 = 12345;        // Create global variable \"GlobalVariable2\" with decimal\n  glob GlobalVariable3 = true;         // Create global variable \"GlobalVariable2\" with boolean\n}\n```\n\n### Calling variables\n\nTo call a variable within the HTML/PHP section, use the following syntax:\n\n```php\n$${\n  set PageTitle = \"My Website | Home\";\n}\n\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003e$$PageTitle\u003c/title\u003e\n  \u003c/head\u003e\n```\n\n### Set Compiler-Flags\nTo view all possible compiler-flags, click [here](https://github.com/TobiHatti/LPHP-Engine/tree/master#compiler-flags).\n\nCompiler-flags can be used to manipulate and modify the output and the resulting PHP-file.\n\nCompiler-flags must be set in the LPHP-instruction-block at the beginning of the page.\n\n```php\n$${\n  NoCompile = true;   // Set the NoCompile-Flag to true \u003e No PHP-file gets created from this file.\n}\n```\n\n### Functions\nFunctions can be called within the HTML/PHP-section of the file.\n\nFor a list of all possible functions, click [here](https://github.com/TobiHatti/LPHP-Engine/tree/master#functions-1)\n\n```php\n\u003cdiv class=\"pageContents\"\u003e\n  $$RenderPage(\"Path/To/File/To/Be/Inserted\")\n\u003c/div\u003e\n```\n\n## LPHP Preprocessor\n### How to set up the LPHP Preprocessor\nDownload the latest installer and run it. It will automatically install \nthe LPHP-Console and the LPHP-UI App on your system. \n\n#### Option A (Recommended):\nCall the LPHP UI App, select your project directory, \ncheck the options you want to enable and start the engine. \nThe app automatically saves your settings for the next session.\n\n![image](https://endev.at/content/projects/LPHP/projectImages/LPHPUISample.png)\n\n#### Option B:\nCall the LPHP-Console without any parameters. Upon startup, the console \nwill prompt you to enter the Path of your LPHP project. After entering the path, \nthe LPHP-Watchdog will constantly monitor the entered directory, until the console is closed.\n\n![image](https://endev.at/content/projects/LPHP/projectImages/LPHPConsoleSample1.png)\n\n#### Option C:\nCall the LPHP-Console with the target directory as a parameter:\n\nThe LPHP-console can accept 1 parameter: The path to the directory, \nwhere the LPHP-Files are located. (Usually the website's root-folder)\n\nProgram-Call (Example):\n`\"C:\\Path\\To\\LPHP\\Executable\\LPHP_Preprocessor.exe\" \"H:\\Projects\\MyPersonalWebsite\"`\n\nIf everything was set up correctly, the preprocessor will constantly watch for changes in the \ndirectory and compile any lphp-files where a change gets detected.\n\n![image](https://endev.at/content/projects/LPHP/projectImages/LPHPConsoleSample2.png)\n\n## Usage\n### Creating a Layout-Page\nTo fully utilise the layout-features, the following template can be used:\n\n- Step 1: Create a Layout-File (.lphp):\nIn this file, the basic layout of the page is defined, such as header, footer, menu, etc.:\n```php\n$${\n  // Filename: sampleLayout.lphp\n  \n  NoCompile = true;\n}\n\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003e$$PageTitle\u003c/title\u003e\n  \u003chead\u003e\n  \u003cbody\u003e\n    \u003cheader\u003e \u003c!-- ... --\u003e \u003c/header\u003e\n    \u003cnav\u003e\n      $$RenderPage(\"templates/menuTemplate.php\")\n    \u003c/nav\u003e\n    \u003cmain\u003e\n      $$RenderBody()\n    \u003c/main\u003e\n    \u003cfooter\u003e \u003c!-- ... --\u003e \u003c/footer\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n- Step 2: Create a content-page (.lphp) that calls the layout:\n```php\n$${\n  // Filename: index.lphp\n  \n  Layout = \"sampleLayout.lphp\";\n  \n  set PageTitle = \"Home\";\n}\n\n\u003ch1\u003eWelcome to my Website\u003c/h1\u003e\n\u003carticle\u003e\n  \u003c!-- ... --\u003e\n\u003c/article\u003e\n```\n\nAfter these files get compiled, one resulting .php-file will be created with the following contents:\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eHome\u003c/title\u003e\n  \u003chead\u003e\n  \u003cbody\u003e\n    \u003cheader\u003e \u003c!-- ... --\u003e \u003c/header\u003e\n    \u003cnav\u003e\n      \u003c!-- Menu Placeholder --\u003e\n    \u003c/nav\u003e\n    \u003cmain\u003e\n      \u003ch1\u003eWelcome to my Website\u003c/h1\u003e\n      \u003carticle\u003e\n        \u003c!-- ... --\u003e\n      \u003c/article\u003e\n    \u003c/main\u003e\n    \u003cfooter\u003e \u003c!-- ... --\u003e \u003c/footer\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\nBy enhancing this sample, you can create multiple layouts that can quickly be \nchanged by simply modifying the \"Layout\"-section in the calling file.\n\n## Currently supported features\n### Functions\n- `$$RenderBody()`:\nOnly used within a layout-file. Pastes the content of the calling file in this section.\n- `$$RenderPage(\"Path/To/File\")`:\nPastes any files content in this section.\n\n### Compiler-Flags\n- `NoCompile` (default: `false`): \nDetermines, if a LPHP file should be converted and saved as a PHP-file. Usually set to `true` in layout-pages.\n\n### Preprocessor-Options\nThese options can be changed in the LPHP.ini-file (by default located under \"C:\\Users\\YOUR_USER\\AppData\\Local\\Endev\\LPHP\"), or by changing the settings in the LPHP-UI App.\n- `REMOVE_HTML_COMMENTS` (default: `True`):\nDetermines, if HTML-comments should still be included in the `.php` output.\n- `MIN_OUTPUT_ENABLED` (default: `True`): Outputs the `.php`-file without line-breaks, tabs or unneccecary white-spaces.\n- `XML_OUTPUT_ENABLED` (default: `False`) Outputs the .php-file with propper indents and line-breaks. (More resource-intensive, causes compile-time to be slower.)\n\n__Note: When only one output mode (`MIN_OUTPUT_ENABLED`, `XML_OUTPUT_ENABLED`) is set to `True`, the file-extension will always be `.php`. When both output-modes are selected, the XML-output has the file-extension `.php` and the MIN-output `.min.php`__\n## FAQ\n\n### Q: When trying to run the programm, Windows-Defender pops up and stops me from running the program.\nA: The reason for this is the new trust-system of windows-defender that came with windows 10, it blocks any programms \nthat don't have enough \"reputation\", which a program gains reputation by getting downloaded by many individuals. \nTherefor a new program with no reputation gets marked as \"Potentially harmfull.\" To install it anyway, \nclick on \"More Info\" and then on \"Run anyway\". Alternatively, you can just download the source-code and compile the program yourself.\n\n## Downloads\n\nGet the current version [here](https://github.com/TobiHatti/LPHP-Engine/releases/latest)\n\nVersion: 1.1.0\n\nMD5: E9151E940F663AB4F97FD57DA4AB9DB9\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobihatti%2Flphp-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobihatti%2Flphp-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobihatti%2Flphp-engine/lists"}