Skip to content

Commit ca07e8d

Browse files
author
mostafa
committed
doc
Co-Authored-By: Mostafa Kamal <[email protected]>
1 parent f8a56ec commit ca07e8d

File tree

1 file changed

+138
-0
lines changed

1 file changed

+138
-0
lines changed

README.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,143 @@
11

22

3+
# install
4+
5+
```bash
6+
composer require code4mk/lara-head
7+
```
8+
9+
# usage meta
10+
11+
~ inside controller
12+
13+
```php
14+
use Khead;
15+
class Test
16+
{
17+
public function home()
18+
{
19+
Khead::setMeta('viewport',[
20+
"name" => "viewport",
21+
"content"=>"width=device-width, initial-scale=1"
22+
]);
23+
}
24+
}
25+
```
26+
27+
~ inside view <access>
28+
29+
```php
30+
{!! Khead::getMeta('viewport') !!}
31+
```
32+
33+
# link
34+
35+
```php
36+
Khead::setLink('author',[
37+
"rel"=>"author",
38+
"href"=>"humans.txt"
39+
]);
40+
// access inside view
41+
42+
{!! Khead::getLink('author') !!}
43+
```
44+
45+
# title
46+
47+
```php
48+
Khead::setTitle('this is a title');
49+
// access view
50+
{!! Khead::getTitle() !!}
51+
```
52+
53+
# facebook open graph
54+
55+
```php
56+
Khead::setOg([
57+
"app_id" => [
58+
"property"=>"fb:app_id",
59+
"content"=>"123456789"
60+
],
61+
"url" => [
62+
"property"=>"og:url",
63+
"content"=>"https://example.com/page.html"
64+
],
65+
"type" => [
66+
"property"=>"og:type", "content"=>"website"
67+
],
68+
"title" => [
69+
"property"=>"og:title",
70+
"content"=>"Content Title"
71+
],
72+
"image" => [
73+
"property"=>"og:image",
74+
"content"=>"https://example.com/image.jpg"
75+
],
76+
"description" => [
77+
"property"=>"og:description",
78+
"content"=>"Description Here"
79+
],
80+
"site_name" => [
81+
"property"=>"og:site_name",
82+
"content"=>"Site Name"
83+
],
84+
"locale" => [
85+
"property"=>"og:locale",
86+
"content"=>"en_US"
87+
],
88+
"author" => [
89+
"property"=>"article:author",
90+
"content"=>"@code4mk"
91+
]
92+
]);
93+
94+
// access with view
95+
96+
{!! Khead::getOg() !!}
97+
```
98+
99+
# twitter cards
100+
101+
```php
102+
Khead::setTwitCards([
103+
"card" => [
104+
"name" => "twitter:card",
105+
"content"=>"summary"
106+
],
107+
"site" => [
108+
"name"=>"twitter:site",
109+
"content"=>"@code4mk"
110+
],
111+
"creator" => [
112+
"name"=>"twitter:creator",
113+
"content"=>"@code4mk"
114+
],
115+
"url" => [
116+
"name"=>"twitter:url",
117+
"content"=>"https://code4mk.org"
118+
],
119+
"title" => [
120+
"name"=>"twitter:title",
121+
"content"=>"Content Title"
122+
],
123+
"description" => [
124+
"name"=>"twitter:description",
125+
"content"=>"Content description less than 200 characters"
126+
],
127+
"image" => [
128+
"name"=>"twitter:image",
129+
"content"=>"https://code4mk.org/image.jpg"
130+
],
131+
"dnt" => [
132+
"name"=>"twitter:dnt",
133+
"content"=>"on"
134+
]
135+
]);
136+
// access inside view
137+
138+
{!! Khead::getTwitCards() !!}
139+
```
140+
3141

4142
# Head tags
5143

0 commit comments

Comments
 (0)