{"id":23842377,"url":"https://github.com/php-toolkit/web-utils","last_synced_at":"2025-02-22T05:23:31.714Z","repository":{"id":57071722,"uuid":"113868503","full_name":"php-toolkit/web-utils","owner":"php-toolkit","description":"some library for php web application","archived":false,"fork":false,"pushed_at":"2018-10-15T06:48:48.000Z","size":41,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-02T18:41:33.001Z","etag":null,"topics":["flash-messages","view-renderer"],"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/php-toolkit.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":"2017-12-11T14:25:59.000Z","updated_at":"2023-05-21T12:37:41.000Z","dependencies_parsed_at":"2022-08-24T14:54:32.138Z","dependency_job_id":null,"html_url":"https://github.com/php-toolkit/web-utils","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-toolkit%2Fweb-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-toolkit%2Fweb-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-toolkit%2Fweb-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-toolkit%2Fweb-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-toolkit","download_url":"https://codeload.github.com/php-toolkit/web-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240129441,"owners_count":19752353,"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":["flash-messages","view-renderer"],"created_at":"2025-01-02T18:38:21.094Z","updated_at":"2025-02-22T05:23:31.688Z","avatar_url":"https://github.com/php-toolkit.png","language":"PHP","readme":"# php web tools\n\n- a simple php view renderer, front assets load manage\n- url,html,curl helper class\n\n## Usage\n\n### View renderer\n\n- support layout, data render\n- support simple assets manage and load\n- support include other file in a view file\n\n```php\n$renderer = new \\Toolkit\\Web\\ViewRenderer([\n    'viewsPath' =\u003e __DIR__ . '/views',\n    'layout' =\u003e 'my-layout.php',\n]);\n\necho $renderer-\u003erender('home/index', ['name' =\u003e 'inhere']);\n```\n\n- setting page attrs and add assets\n\n```php\n// before call render()\n$renderer\n    // page info\n    -\u003esetPageTitle($title)\n    -\u003esetPageMeta($keywords, $description)\n    // assets\n    -\u003eaddTopCssFile('/assets/libs/highlight/styles/default.css')\n    -\u003eaddBottomJsFile([\n        '/assets/libs/highlight/highlight.pack.js',\n        '/assets/libs/markdown-it/markdown-it.min.js',\n        '/assets/src/article/view.js'\n    ]);\n```\n\n- in view template file.\n\n```php\n/**\n * @var \\Toolkit\\Web\\ViewRenderer $this\n */\n\n\u003c!doctype html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003c!-- Required meta tags --\u003e\n  \u003cmeta charset=\"utf-8\"\u003e\n  \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\"\u003e\n  \u003clink href=\"/assets/libs/bootstrap/bootstrap.min.css\" rel=\"stylesheet\"\u003e\n  \u003clink href=\"/assets/src/app.css\" rel=\"stylesheet\"\u003e\n  \u003ctitle\u003e\u003c?= $this-\u003egetTitle('Hello, world!') ?\u003e\u003c/title\u003e\n  \u003c!-- output page assets --\u003e\n  \u003c?php $this-\u003edumpTopAssets() ?\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\n\u003c?php $this-\u003einclude('_layouts/common-header'); ?\u003e\n\n\u003cmain role=\"main\" class=\"container content-main\"\u003e\n  \u003cdiv class=\"row\"\u003e\n    \u003cdiv class=\"col-md-8 blog-main\"\u003e\n    \u003c!-- content output --\u003e\n    {__CONTENT__}\n    \u003c/div\u003e\n    \u003caside class=\"col-md-4\"\u003e\n      sadebar .... my name is: \u003c?= $name ?\u003e\n    \u003c/aside\u003e\n  \u003c/div\u003e\n\u003c/main\u003e\n\n\u003c?php $this-\u003einclude('_layouts/common-footer'); ?\u003e\n\n\u003c!-- Optional JavaScript --\u003e\n\u003c!-- jQuery first, then Popper.js, then Bootstrap JS --\u003e\n\u003cscript src=\"/assets/libs/jquery.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"/assets/libs/bootstrap/bootstrap.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"/assets/src/app.js\"\u003e\u003c/script\u003e\n\n\u003c!-- output page assets --\u003e\n\u003c?php $this-\u003edumpBottomAssets() ?\u003e\n\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n### Flash Messages\n\n```php\n$flash = new Flash();\n\n// a page\n$flash-\u003ewarning('page-msg', 'Please login to operate!');\n\n// an other page\n$msg = $flash-\u003eget('page-msg');\n```\n\n## license\n\n**[MIT](LICENSE)**\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-toolkit%2Fweb-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-toolkit%2Fweb-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-toolkit%2Fweb-utils/lists"}