Skip to content

Commit

Permalink
update readme and deps
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Nov 10, 2021
1 parent 7929e81 commit a73c224
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 22 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,4 @@ jobs:
# Docs: https://getcomposer.org/doc/articles/scripts.md

- name: Run test suite
run: phpunit -v

# git status && git log -1 && git fetch --tags --force
# git status && git log -1 && git fetch --prune --unshallow
# git status && git log -1 && git fetch --depth=500 --tags --force
# - name: Generate changelog
# if: ${{ matrix.os == 'ubuntu-latest' && matrix.php == '7.4' }}
# run: |
# echo "changelog list by kite"
# php bin/kite git chlog last head --style gh-release --no-merges --fetch-tags --unshallow --file tmp/changelog.md
# cat tmp/changelog.md
run: phpunit --debug
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ jobs:
with:
name: ${{ env.RELEASE_TAG }}
tag_name: ${{ env.RELEASE_TAG }}
body_path: changelog.md
body_path: changelog.md
# files: kite-${{ env.RELEASE_TAG }}.phar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GITHUB_REPOSITORY: my_gh_org/my_gh_repo
# GITHUB_REPOSITORY: my_gh_org/my_gh_repo
72 changes: 66 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# EasyTpl

[![License](https://img.shields.io/packagist/l/phppkg/easytpl.svg?style=flat-square)](LICENSE)
[![Php Version](https://img.shields.io/badge/php-%3E=7.4.0-brightgreen.svg?maxAge=2592000)](https://packagist.org/packages/phppkg/easytpl)
[![Php Version](https://img.shields.io/badge/php-%3E=8.0-brightgreen.svg?maxAge=2592000)](https://packagist.org/packages/phppkg/easytpl)
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/phppkg/easytpl)](https://github.com/phppkg/easytpl)
[![Actions Status](https://github.com/phppkg/easytpl/workflows/Unit-Tests/badge.svg)](https://github.com/phppkg/easytpl/actions)

⚡️ Simple and fastly text template engine for PHP
⚡️ Simple and fastly template engine for PHP

## Features

- it's simple and fastly
- simple echo syntax. eg: `{{= $var }}` `{{ $var }}` `{{ echo $var }}`
- support php builtin string function as filters. eg: `{{ $var | ucfirst }}`
- support add custom filters.
- support add custom directive. eg: `include` - `{{ include('other.tpl') }}`
- support all syntax:`if,elseif,else;foreach;for;switch...`

## Install

Expand All @@ -15,13 +24,64 @@
composer require phppkg/easytpl
```

## Usage
## Quick start

```php
use PhpPkg\EasyTpl\EasyTemplate;

$t = new EasyTemplate();
$t->renderString($tplCode);
```

## Custom directive

You can use the directives implement some special logic.



```php

```

## Using the filters

You can use the filters in any of your templates.

**Regular usage**:

```php
{{ 'john' | ucfirst }} // John
```

**Chained usage**:

```php
{{ 'john' | ucfirst | substr:0,1 }} // J
{{ '1999-12-31' | date:'Y/m/d' }} // 1999/12/31
```

**Passing non-static values**:

```php
{{ $name | ucfirst | substr:0,1 }}
{{ $user['name'] | ucfirst | substr:0,1 }}
{{ $currentUser->name | ucfirst | substr:0,1 }}
{{ getName() | ucfirst | substr:0,1 }}
```

**Passing variables as filter parameters**:

```php
use PhpPkg\EasyTpl\FastTemplate;
$currency = 'HUF'
{{ '12.75' | currency:$currency }} // HUF 12.75
```

$t = new FastTemplate();
$t->parse();
**Built-in functionality**:

```php
{{ 'This is a title' | slug }} // this-is-a-title
{{ 'This is a title' | title }} // This Is A Title
{{ 'foo_bar' | studly }} // FooBar
```

## License
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phppkg/easytpl",
"description": "⚡️ Simple and fast template engine for PHP",
"description": "⚡️ Simple and fastly template engine for PHP",
"type": "template",
"license": "MIT",
"homepage": "https://github.com/phppkg/easytpl",
Expand All @@ -11,9 +11,10 @@
}
],
"require": {
"php": ">7.4.0",
"php": ">8.0",
"ext-mbstring": "*",
"toolkit/cli-utils":"~1.0"
"toolkit/fsutil":"~1.0",
"toolkit/stdlib":"~1.0"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit a73c224

Please sign in to comment.