Skip to content

Commit 185a6dc

Browse files
committed
Initial implementation
0 parents  commit 185a6dc

7 files changed

Lines changed: 732 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bin
2+
vendor

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Twig PHP Function [![Build Status](https://travis-ci.org/umpirsky/twig-php-function.svg?branch=master)](https://travis-ci.org/umpirsky/twig-php-function)
2+
3+
Call (almost) any PHP function from your Twig templates.
4+
5+
## Usage
6+
7+
After [registering](http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension) `PhpFunctionExtension` call PHP functions from your templates like this:
8+
9+
```twig
10+
Hi, I am unique: {{ php_uniqid() }}.
11+
12+
And {{ php_floor(7.7) }} is floor of 7.7.
13+
```
14+
15+
As you can see, just prefix PHP function with `php_` prefix and that's is.

composer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "umpirsky/twig-php-function",
3+
"type": "library",
4+
"description": "Call (almost) any PHP function from your Twig templates.",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Saša Stamenković",
9+
"email": "umpirsky@gmail.com"
10+
}
11+
],
12+
"require": {
13+
"php": "~5.4",
14+
"twig/twig": "~1.12"
15+
},
16+
"require-dev": {
17+
"phpspec/phpspec": "~2.0"
18+
},
19+
"config": {
20+
"bin-dir": "bin"
21+
},
22+
"autoload": {
23+
"psr-0": { "Umpirsky\\": "src/" }
24+
}
25+
}

0 commit comments

Comments
 (0)