2017-25 © Pedro Peláez
 

library web-utils

a simple web tool library of the php

image

toolkit/web-utils

a simple web tool library of the php

  • Sunday, June 10, 2018
  • by inhere
  • Repository
  • 1 Watchers
  • 1 Stars
  • 16 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 100 % Grown

The README.md

php web tools

  • a simple php view renderer, front assets load manage
  • url,html,curl helper class

Usage

View renderer

  • support layout, data render
  • support simple assets manage and load
  • support include other file in a view file
$renderer = new \Toolkit\Web\ViewRenderer([
    'viewsPath' => __DIR__ . '/views',
    'layout' => 'my-layout.php',
]);

echo $renderer->render('home/index', ['name' => 'inhere']);
  • setting page attrs and add assets
// before call render()
$renderer
    // page info
    ->setPageTitle($title)
    ->setPageMeta($keywords, $description)
    // assets
    ->addTopCssFile('/assets/libs/highlight/styles/default.css')
    ->addBottomJsFile([
        '/assets/libs/highlight/highlight.pack.js',
        '/assets/libs/markdown-it/markdown-it.min.js',
        '/assets/src/article/view.js'
    ]);
  • in view template file.
/**
 * @var \Toolkit\Web\ViewRenderer $this
 */

<!doctype html>
<html lang="en">
<head>
  
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link href="/assets/libs/bootstrap/bootstrap.min.css" rel="stylesheet">
  <link href="/assets/src/app.css" rel="stylesheet">
  <title>= $this->getTitle('Hello, world!') ?></title>
  
  dumpTopAssets() ?>
</head>
<body>

include('_layouts/common-header'); ?>

<main role="main" class="container content-main">


{__CONTENT__}
</main> include('_layouts/common-footer'); ?> dumpBottomAssets() ?> </body> </html>

Flash Messages

$flash = new Flash();

// a page
$flash->warning('page-msg', 'Please login to operate!');

// an other page
$msg = $flash->get('page-msg');

license

MIT, (*1)

The Versions

10/06 2018

dev-master

9999999-dev https://github.com/php-toolkit/web-utils

a simple web tool library of the php

  Sources   Download

MIT

The Requires

 

library view-renderer

10/06 2018

v1.0.5

1.0.5.0 https://github.com/php-toolkit/web-utils

a simple web tool library of the php

  Sources   Download

MIT

The Requires

 

library view-renderer

09/06 2018

v1.0.4

1.0.4.0 https://github.com/php-toolkit/web-utils

a simple web tool library of the php

  Sources   Download

MIT

The Requires

 

library view-renderer

30/05 2018

v1.0.3

1.0.3.0 https://github.com/php-toolkit/web-utils

a simple web tool library of the php

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

library

02/05 2018

v1.0.2

1.0.2.0 https://github.com/php-toolkit/web-utils

a simple web tool library of the php

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

library

01/05 2018

v1.0.1

1.0.1.0 https://github.com/php-toolkit/web-utils

a simple web tool library of the php

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

library

08/02 2018

v1.0.0

1.0.0.0 https://github.com/php-mylib/web-utils

a simple web tool library of the php

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

library