Skip to content

Commit 6f872c8

Browse files
committed
1 parent 0eac55a commit 6f872c8

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# html_build_attributes
2+
3+
(PHP 5 >= 5.4)
4+
`html_build_attributes` — Generate a string of HTML attributes.
5+
6+
## Description
7+
8+
```php
9+
string html_build_attributes( array $attr [, callable $callback = null ] )
10+
```
11+
12+
Generate a string of HTML attributes from the associative array provided.
13+
14+
## Parameters
15+
16+
- `attr` — Associative array, or object containing properties, representing attribute names and values.
17+
If `attr` is an object, then only public properties will be incorporated into the result.
18+
If a value is an array, its values will be concatenated and delimited with a space.
19+
- `$callback` — Callback function for escaping the values for the HTML attributes.
20+
21+
## Return Values
22+
23+
Returns a string of HTML attributes.
24+
25+
## Installation
26+
27+
### With Composer
28+
29+
```
30+
$ composer require mcaskill/php-html-build-attributes
31+
```
32+
33+
```json
34+
{
35+
"repositories": [
36+
{
37+
"type": "git",
38+
"url": "https://gist.github.com/***.git"
39+
}
40+
],
41+
"require": {
42+
"mcaskill/php-html-build-attributes": "dev-master"
43+
}
44+
}
45+
```
46+
47+
### Without Composer
48+
49+
Why are you not using [composer](http://getcomposer.org/)? Download `Function.HTML-Build-Attributes.php` from the gist and save the file into your project path somewhere.

composer.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "mcaskill/php-html-build-attributes",
3+
"description": "Generate a string of HTML attributes.",
4+
"authors": [
5+
{
6+
"name": "Chauncey McAskill",
7+
"email": "chauncey@mcaskill.ca",
8+
"homepage": "https://github.com/mcaskill"
9+
}
10+
],
11+
"keywords": [
12+
"function",
13+
"wordpress"
14+
],
15+
"require": {
16+
"php": ">=5.4.0"
17+
},
18+
"autoload": {
19+
"files": [ "Function.HTML-Build-Attributes.php" ]
20+
}
21+
}

0 commit comments

Comments
 (0)