@enjoys/context-engine 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/commands/adb.json +322 -0
- package/data/commands/alembic.json +301 -0
- package/data/commands/artisan.json +277 -0
- package/data/commands/atlas.json +426 -0
- package/data/commands/auth0.json +648 -0
- package/data/commands/bat.json +84 -0
- package/data/commands/bundle.json +321 -0
- package/data/commands/composer.json +507 -0
- package/data/commands/dart.json +216 -0
- package/data/commands/dbmate.json +257 -0
- package/data/commands/docker-compose.json +384 -0
- package/data/commands/drizzle-kit.json +217 -0
- package/data/commands/expo.json +65 -0
- package/data/commands/fastlane.json +243 -0
- package/data/commands/fd.json +86 -0
- package/data/commands/flutter.json +298 -0
- package/data/commands/flyway.json +261 -0
- package/data/commands/fzf.json +103 -0
- package/data/commands/gem.json +267 -0
- package/data/commands/jq.json +100 -0
- package/data/commands/k9s.json +62 -0
- package/data/commands/liquibase.json +399 -0
- package/data/commands/manifest.json +619 -0
- package/data/commands/minikube.json +60 -0
- package/data/commands/ng.json +64 -0
- package/data/commands/nuxt.json +60 -0
- package/data/commands/php.json +157 -0
- package/data/commands/pm2.json +259 -0
- package/data/commands/pod.json +175 -0
- package/data/commands/prisma.json +257 -0
- package/data/commands/rails.json +372 -0
- package/data/commands/rake.json +360 -0
- package/data/commands/react-native.json +57 -0
- package/data/commands/rg.json +103 -0
- package/data/commands/rspec.json +257 -0
- package/data/commands/ruby.json +108 -0
- package/data/commands/sequelize.json +342 -0
- package/data/commands/snyk.json +442 -0
- package/data/commands/sonar-scanner.json +219 -0
- package/data/commands/stripe.json +314 -0
- package/data/commands/symfony.json +449 -0
- package/data/commands/tmux.json +197 -0
- package/data/commands/trivy.json +367 -0
- package/data/commands/twilio.json +382 -0
- package/data/commands/typeorm.json +262 -0
- package/data/commands/vue.json +60 -0
- package/data/commands/wp.json +857 -0
- package/data/commands/xcodebuild.json +141 -0
- package/data/commands/yq.json +57 -0
- package/data/completion/bash.json +1184 -0
- package/data/completion/c.json +1067 -0
- package/data/completion/cpp.json +824 -0
- package/data/completion/csharp.json +860 -0
- package/data/completion/dockerfile.json +536 -0
- package/data/completion/go.json +1346 -0
- package/data/completion/html.json +806 -0
- package/data/completion/java.json +1112 -0
- package/data/completion/javascript.json +914 -0
- package/data/completion/lua.json +968 -0
- package/data/completion/php.json +1535 -0
- package/data/completion/python.json +1427 -0
- package/data/completion/ruby.json +1531 -0
- package/data/completion/rust.json +698 -0
- package/data/completion/sql.json +887 -0
- package/data/completion/toml.json +428 -0
- package/data/completion/typescript.json +338 -0
- package/data/completion/yaml.json +563 -0
- package/data/defination/bash.json +565 -0
- package/data/defination/c.json +865 -0
- package/data/defination/cpp.json +348 -0
- package/data/defination/csharp.json +144 -0
- package/data/defination/dockerfile.json +113 -0
- package/data/defination/go.json +561 -0
- package/data/defination/html.json +559 -0
- package/data/defination/java.json +184 -0
- package/data/defination/javascript.json +265 -0
- package/data/defination/lua.json +181 -0
- package/data/defination/php.json +726 -0
- package/data/defination/python.json +717 -0
- package/data/defination/ruby.json +670 -0
- package/data/defination/rust.json +207 -0
- package/data/defination/sql.json +473 -0
- package/data/defination/toml.json +251 -0
- package/data/defination/typescript.json +29 -0
- package/data/defination/yaml.json +197 -0
- package/data/hover/bash.json +245 -0
- package/data/hover/c.json +265 -0
- package/data/hover/cpp.json +210 -0
- package/data/hover/csharp.json +290 -0
- package/data/hover/dockerfile.json +145 -0
- package/data/hover/go.json +580 -0
- package/data/hover/html.json +250 -0
- package/data/hover/java.json +395 -0
- package/data/hover/javascript.json +330 -0
- package/data/hover/lua.json +265 -0
- package/data/hover/php.json +300 -0
- package/data/hover/python.json +380 -0
- package/data/hover/ruby.json +265 -0
- package/data/hover/rust.json +275 -0
- package/data/hover/sql.json +230 -0
- package/data/hover/toml.json +145 -0
- package/data/hover/typescript.json +120 -0
- package/data/hover/yaml.json +165 -0
- package/data/manifest.json +242 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1535 @@
|
|
|
1
|
+
{
|
|
2
|
+
"language": "php",
|
|
3
|
+
"completions": [
|
|
4
|
+
{
|
|
5
|
+
"label": "echo",
|
|
6
|
+
"kind": 14,
|
|
7
|
+
"detail": "Output one or more strings",
|
|
8
|
+
"documentation": { "value": "Outputs one or more expressions, with no additional newline or space.\n\n```php\necho 'Hello, World!';\necho $name, ' is ', $age;\necho \"Value: {$var}\";\n```" },
|
|
9
|
+
"insertText": "echo ${1:expression};",
|
|
10
|
+
"insertTextRules": 4,
|
|
11
|
+
"sortText": "00_echo"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"label": "print",
|
|
15
|
+
"kind": 14,
|
|
16
|
+
"detail": "Output a string",
|
|
17
|
+
"documentation": { "value": "Outputs a string. Unlike echo, print accepts only one argument and always returns 1.\n\n```php\nprint 'Hello, World!';\nprint(\"Value: $var\");\n$result = print 'test';\n```" },
|
|
18
|
+
"insertText": "print ${1:expression};",
|
|
19
|
+
"insertTextRules": 4,
|
|
20
|
+
"sortText": "00_print"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"label": "var_dump",
|
|
24
|
+
"kind": 1,
|
|
25
|
+
"detail": "Dump variable information",
|
|
26
|
+
"documentation": { "value": "Displays structured information about one or more expressions including its type and value.\n\n```php\nvar_dump($variable);\nvar_dump($arr, $obj, $bool);\nvar_dump(['a' => 1, 'b' => 2]);\n```" },
|
|
27
|
+
"insertText": "var_dump(${1:\\$variable});",
|
|
28
|
+
"insertTextRules": 4,
|
|
29
|
+
"sortText": "00_var_dump"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"label": "print_r",
|
|
33
|
+
"kind": 1,
|
|
34
|
+
"detail": "Print human-readable variable info",
|
|
35
|
+
"documentation": { "value": "Prints human-readable information about a variable. Especially useful for arrays and objects.\n\n```php\nprint_r($array);\n$output = print_r($array, true);\nprint_r(['name' => 'John', 'age' => 30]);\n```" },
|
|
36
|
+
"insertText": "print_r(${1:\\$variable});",
|
|
37
|
+
"insertTextRules": 4,
|
|
38
|
+
"sortText": "00_print_r"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"label": "var_export",
|
|
42
|
+
"kind": 1,
|
|
43
|
+
"detail": "Output parsable string representation",
|
|
44
|
+
"documentation": { "value": "Outputs or returns a parsable string representation of a variable.\n\n```php\nvar_export($array);\n$code = var_export($array, true);\nvar_export(['key' => 'value']);\n```" },
|
|
45
|
+
"insertText": "var_export(${1:\\$variable}, ${2:false});",
|
|
46
|
+
"insertTextRules": 4,
|
|
47
|
+
"sortText": "00_var_export"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"label": "printf",
|
|
51
|
+
"kind": 1,
|
|
52
|
+
"detail": "Output a formatted string",
|
|
53
|
+
"documentation": { "value": "Outputs a formatted string using format specifiers.\n\n```php\nprintf('Name: %s, Age: %d', $name, $age);\nprintf('Price: $%.2f', $price);\nprintf('%05d', $number);\n```" },
|
|
54
|
+
"insertText": "printf('${1:%s}', ${2:\\$value});",
|
|
55
|
+
"insertTextRules": 4,
|
|
56
|
+
"sortText": "00_printf"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"label": "sprintf",
|
|
60
|
+
"kind": 1,
|
|
61
|
+
"detail": "Return a formatted string",
|
|
62
|
+
"documentation": { "value": "Returns a formatted string without outputting it.\n\n```php\n$msg = sprintf('Hello, %s!', $name);\n$price = sprintf('$%.2f', 19.99);\n$padded = sprintf('%05d', 42);\n```" },
|
|
63
|
+
"insertText": "sprintf('${1:%s}', ${2:\\$value})",
|
|
64
|
+
"insertTextRules": 4,
|
|
65
|
+
"sortText": "00_sprintf"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"label": "strlen",
|
|
69
|
+
"kind": 1,
|
|
70
|
+
"detail": "Get string length",
|
|
71
|
+
"documentation": { "value": "Returns the length of the given string in bytes.\n\n```php\n$len = strlen('Hello'); // 5\n$len = strlen($str);\nif (strlen($input) > 0) { ... }\n```" },
|
|
72
|
+
"insertText": "strlen(${1:\\$string})",
|
|
73
|
+
"insertTextRules": 4,
|
|
74
|
+
"sortText": "01_strlen"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"label": "strpos",
|
|
78
|
+
"kind": 1,
|
|
79
|
+
"detail": "Find position of first occurrence",
|
|
80
|
+
"documentation": { "value": "Finds the position of the first occurrence of a substring in a string.\n\n```php\n$pos = strpos('Hello World', 'World'); // 6\nif (strpos($haystack, $needle) !== false) { ... }\n$pos = strpos($str, 'x', 5);\n```" },
|
|
81
|
+
"insertText": "strpos(${1:\\$haystack}, ${2:\\$needle})",
|
|
82
|
+
"insertTextRules": 4,
|
|
83
|
+
"sortText": "01_strpos"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"label": "strrpos",
|
|
87
|
+
"kind": 1,
|
|
88
|
+
"detail": "Find position of last occurrence",
|
|
89
|
+
"documentation": { "value": "Finds the position of the last occurrence of a substring in a string.\n\n```php\n$pos = strrpos('Hello World Hello', 'Hello'); // 12\n$pos = strrpos($path, '/');\n```" },
|
|
90
|
+
"insertText": "strrpos(${1:\\$haystack}, ${2:\\$needle})",
|
|
91
|
+
"insertTextRules": 4,
|
|
92
|
+
"sortText": "01_strrpos"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"label": "substr",
|
|
96
|
+
"kind": 1,
|
|
97
|
+
"detail": "Return part of a string",
|
|
98
|
+
"documentation": { "value": "Returns the portion of string specified by the offset and length parameters.\n\n```php\n$part = substr('Hello World', 0, 5); // 'Hello'\n$last = substr($str, -3);\n$rest = substr($str, 6);\n```" },
|
|
99
|
+
"insertText": "substr(${1:\\$string}, ${2:offset}, ${3:length})",
|
|
100
|
+
"insertTextRules": 4,
|
|
101
|
+
"sortText": "01_substr"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"label": "str_replace",
|
|
105
|
+
"kind": 1,
|
|
106
|
+
"detail": "Replace all occurrences of a string",
|
|
107
|
+
"documentation": { "value": "Replaces all occurrences of the search string with the replacement string.\n\n```php\n$result = str_replace('world', 'PHP', 'Hello world');\n$clean = str_replace([' ', '-'], '_', $str);\n$result = str_replace($search, $replace, $subject, $count);\n```" },
|
|
108
|
+
"insertText": "str_replace(${1:\\$search}, ${2:\\$replace}, ${3:\\$subject})",
|
|
109
|
+
"insertTextRules": 4,
|
|
110
|
+
"sortText": "01_str_replace"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"label": "str_contains",
|
|
114
|
+
"kind": 1,
|
|
115
|
+
"detail": "Check if string contains substring (PHP 8.0+)",
|
|
116
|
+
"documentation": { "value": "Determines if a string contains a given substring.\n\n```php\nif (str_contains('Hello World', 'World')) { ... }\nif (str_contains($haystack, $needle)) { ... }\n```" },
|
|
117
|
+
"insertText": "str_contains(${1:\\$haystack}, ${2:\\$needle})",
|
|
118
|
+
"insertTextRules": 4,
|
|
119
|
+
"sortText": "01_str_contains"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"label": "str_starts_with",
|
|
123
|
+
"kind": 1,
|
|
124
|
+
"detail": "Check if string starts with substring (PHP 8.0+)",
|
|
125
|
+
"documentation": { "value": "Checks if a string starts with a given substring.\n\n```php\nif (str_starts_with($url, 'https://')) { ... }\nif (str_starts_with($line, '#')) { ... }\n```" },
|
|
126
|
+
"insertText": "str_starts_with(${1:\\$haystack}, ${2:\\$needle})",
|
|
127
|
+
"insertTextRules": 4,
|
|
128
|
+
"sortText": "01_str_starts_with"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"label": "str_ends_with",
|
|
132
|
+
"kind": 1,
|
|
133
|
+
"detail": "Check if string ends with substring (PHP 8.0+)",
|
|
134
|
+
"documentation": { "value": "Checks if a string ends with a given substring.\n\n```php\nif (str_ends_with($file, '.php')) { ... }\nif (str_ends_with($url, '/')) { ... }\n```" },
|
|
135
|
+
"insertText": "str_ends_with(${1:\\$haystack}, ${2:\\$needle})",
|
|
136
|
+
"insertTextRules": 4,
|
|
137
|
+
"sortText": "01_str_ends_with"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"label": "strtolower",
|
|
141
|
+
"kind": 1,
|
|
142
|
+
"detail": "Convert string to lowercase",
|
|
143
|
+
"documentation": { "value": "Returns a string with all ASCII alphabetic characters converted to lowercase.\n\n```php\n$lower = strtolower('Hello World'); // 'hello world'\n$lower = strtolower($input);\n```" },
|
|
144
|
+
"insertText": "strtolower(${1:\\$string})",
|
|
145
|
+
"insertTextRules": 4,
|
|
146
|
+
"sortText": "01_strtolower"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"label": "strtoupper",
|
|
150
|
+
"kind": 1,
|
|
151
|
+
"detail": "Convert string to uppercase",
|
|
152
|
+
"documentation": { "value": "Returns a string with all ASCII alphabetic characters converted to uppercase.\n\n```php\n$upper = strtoupper('Hello World'); // 'HELLO WORLD'\n$upper = strtoupper($input);\n```" },
|
|
153
|
+
"insertText": "strtoupper(${1:\\$string})",
|
|
154
|
+
"insertTextRules": 4,
|
|
155
|
+
"sortText": "01_strtoupper"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"label": "trim",
|
|
159
|
+
"kind": 1,
|
|
160
|
+
"detail": "Strip whitespace from both ends",
|
|
161
|
+
"documentation": { "value": "Strips whitespace (or other characters) from the beginning and end of a string.\n\n```php\n$clean = trim(' Hello '); // 'Hello'\n$clean = trim($input, '/');\n```" },
|
|
162
|
+
"insertText": "trim(${1:\\$string})",
|
|
163
|
+
"insertTextRules": 4,
|
|
164
|
+
"sortText": "01_trim"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"label": "ltrim",
|
|
168
|
+
"kind": 1,
|
|
169
|
+
"detail": "Strip whitespace from the beginning",
|
|
170
|
+
"documentation": { "value": "Strips whitespace (or other characters) from the beginning of a string.\n\n```php\n$clean = ltrim(' Hello'); // 'Hello'\n$clean = ltrim($path, '/');\n```" },
|
|
171
|
+
"insertText": "ltrim(${1:\\$string})",
|
|
172
|
+
"insertTextRules": 4,
|
|
173
|
+
"sortText": "01_ltrim"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"label": "rtrim",
|
|
177
|
+
"kind": 1,
|
|
178
|
+
"detail": "Strip whitespace from the end",
|
|
179
|
+
"documentation": { "value": "Strips whitespace (or other characters) from the end of a string.\n\n```php\n$clean = rtrim('Hello '); // 'Hello'\n$clean = rtrim($path, '/');\n```" },
|
|
180
|
+
"insertText": "rtrim(${1:\\$string})",
|
|
181
|
+
"insertTextRules": 4,
|
|
182
|
+
"sortText": "01_rtrim"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"label": "explode",
|
|
186
|
+
"kind": 1,
|
|
187
|
+
"detail": "Split a string by a delimiter",
|
|
188
|
+
"documentation": { "value": "Splits a string by a string delimiter and returns an array.\n\n```php\n$parts = explode(',', 'a,b,c'); // ['a', 'b', 'c']\n$words = explode(' ', $sentence);\n$parts = explode('/', $path, 3);\n```" },
|
|
189
|
+
"insertText": "explode(${1:'${2:delimiter}'}, ${3:\\$string})",
|
|
190
|
+
"insertTextRules": 4,
|
|
191
|
+
"sortText": "01_explode"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"label": "implode",
|
|
195
|
+
"kind": 1,
|
|
196
|
+
"detail": "Join array elements with a string",
|
|
197
|
+
"documentation": { "value": "Joins array elements with a glue string.\n\n```php\n$str = implode(', ', ['a', 'b', 'c']); // 'a, b, c'\n$csv = implode(',', $values);\n$path = implode('/', $segments);\n```" },
|
|
198
|
+
"insertText": "implode(${1:'${2:glue}'}, ${3:\\$array})",
|
|
199
|
+
"insertTextRules": 4,
|
|
200
|
+
"sortText": "01_implode"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"label": "str_pad",
|
|
204
|
+
"kind": 1,
|
|
205
|
+
"detail": "Pad a string to a certain length",
|
|
206
|
+
"documentation": { "value": "Pads a string to a certain length with another string.\n\n```php\n$padded = str_pad('42', 5, '0', STR_PAD_LEFT); // '00042'\n$padded = str_pad($str, 20);\n```" },
|
|
207
|
+
"insertText": "str_pad(${1:\\$string}, ${2:length}, ${3:' '}, ${4:STR_PAD_RIGHT})",
|
|
208
|
+
"insertTextRules": 4,
|
|
209
|
+
"sortText": "01_str_pad"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"label": "str_repeat",
|
|
213
|
+
"kind": 1,
|
|
214
|
+
"detail": "Repeat a string",
|
|
215
|
+
"documentation": { "value": "Repeats a string a given number of times.\n\n```php\n$line = str_repeat('-', 40);\n$indent = str_repeat(' ', $level);\n```" },
|
|
216
|
+
"insertText": "str_repeat(${1:\\$string}, ${2:times})",
|
|
217
|
+
"insertTextRules": 4,
|
|
218
|
+
"sortText": "01_str_repeat"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"label": "str_word_count",
|
|
222
|
+
"kind": 1,
|
|
223
|
+
"detail": "Count words in a string",
|
|
224
|
+
"documentation": { "value": "Counts the number of words in a string.\n\n```php\n$count = str_word_count('Hello beautiful world'); // 3\n$words = str_word_count($text, 1); // array of words\n```" },
|
|
225
|
+
"insertText": "str_word_count(${1:\\$string})",
|
|
226
|
+
"insertTextRules": 4,
|
|
227
|
+
"sortText": "01_str_word_count"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"label": "str_split",
|
|
231
|
+
"kind": 1,
|
|
232
|
+
"detail": "Split string into array of chunks",
|
|
233
|
+
"documentation": { "value": "Converts a string to an array, splitting into chunks of given length.\n\n```php\n$chars = str_split('Hello'); // ['H','e','l','l','o']\n$chunks = str_split($str, 3);\n```" },
|
|
234
|
+
"insertText": "str_split(${1:\\$string}, ${2:1})",
|
|
235
|
+
"insertTextRules": 4,
|
|
236
|
+
"sortText": "01_str_split"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"label": "ucfirst",
|
|
240
|
+
"kind": 1,
|
|
241
|
+
"detail": "Uppercase first character",
|
|
242
|
+
"documentation": { "value": "Returns a string with the first character uppercased.\n\n```php\n$name = ucfirst('hello'); // 'Hello'\n```" },
|
|
243
|
+
"insertText": "ucfirst(${1:\\$string})",
|
|
244
|
+
"insertTextRules": 4,
|
|
245
|
+
"sortText": "01_ucfirst"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"label": "lcfirst",
|
|
249
|
+
"kind": 1,
|
|
250
|
+
"detail": "Lowercase first character",
|
|
251
|
+
"documentation": { "value": "Returns a string with the first character lowercased.\n\n```php\n$name = lcfirst('Hello'); // 'hello'\n```" },
|
|
252
|
+
"insertText": "lcfirst(${1:\\$string})",
|
|
253
|
+
"insertTextRules": 4,
|
|
254
|
+
"sortText": "01_lcfirst"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"label": "ucwords",
|
|
258
|
+
"kind": 1,
|
|
259
|
+
"detail": "Uppercase first letter of each word",
|
|
260
|
+
"documentation": { "value": "Returns a string with the first character of each word uppercased.\n\n```php\n$title = ucwords('hello world'); // 'Hello World'\n$title = ucwords($str, '-');\n```" },
|
|
261
|
+
"insertText": "ucwords(${1:\\$string})",
|
|
262
|
+
"insertTextRules": 4,
|
|
263
|
+
"sortText": "01_ucwords"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"label": "nl2br",
|
|
267
|
+
"kind": 1,
|
|
268
|
+
"detail": "Insert HTML line breaks",
|
|
269
|
+
"documentation": { "value": "Inserts HTML line breaks before all newlines in a string.\n\n```php\n$html = nl2br(\"Hello\\nWorld\");\necho nl2br($text);\n```" },
|
|
270
|
+
"insertText": "nl2br(${1:\\$string})",
|
|
271
|
+
"insertTextRules": 4,
|
|
272
|
+
"sortText": "01_nl2br"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"label": "htmlspecialchars",
|
|
276
|
+
"kind": 1,
|
|
277
|
+
"detail": "Convert special characters to HTML entities",
|
|
278
|
+
"documentation": { "value": "Converts special characters to HTML entities for safe output.\n\n```php\n$safe = htmlspecialchars($input, ENT_QUOTES, 'UTF-8');\necho htmlspecialchars($userInput);\n```" },
|
|
279
|
+
"insertText": "htmlspecialchars(${1:\\$string}, ENT_QUOTES, 'UTF-8')",
|
|
280
|
+
"insertTextRules": 4,
|
|
281
|
+
"sortText": "01_htmlspecialchars"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"label": "htmlentities",
|
|
285
|
+
"kind": 1,
|
|
286
|
+
"detail": "Convert all applicable characters to HTML entities",
|
|
287
|
+
"documentation": { "value": "Converts all applicable characters to HTML entities.\n\n```php\n$safe = htmlentities($input, ENT_QUOTES, 'UTF-8');\n```" },
|
|
288
|
+
"insertText": "htmlentities(${1:\\$string}, ENT_QUOTES, 'UTF-8')",
|
|
289
|
+
"insertTextRules": 4,
|
|
290
|
+
"sortText": "01_htmlentities"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"label": "urlencode",
|
|
294
|
+
"kind": 1,
|
|
295
|
+
"detail": "URL-encode a string",
|
|
296
|
+
"documentation": { "value": "URL-encodes a string, replacing special characters with percent-encoded values.\n\n```php\n$encoded = urlencode('Hello World'); // 'Hello+World'\n$url = 'search?q=' . urlencode($query);\n```" },
|
|
297
|
+
"insertText": "urlencode(${1:\\$string})",
|
|
298
|
+
"insertTextRules": 4,
|
|
299
|
+
"sortText": "01_urlencode"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"label": "urldecode",
|
|
303
|
+
"kind": 1,
|
|
304
|
+
"detail": "Decode a URL-encoded string",
|
|
305
|
+
"documentation": { "value": "Decodes any percent-encoded characters in the given string.\n\n```php\n$decoded = urldecode('Hello+World'); // 'Hello World'\n$decoded = urldecode($encodedStr);\n```" },
|
|
306
|
+
"insertText": "urldecode(${1:\\$string})",
|
|
307
|
+
"insertTextRules": 4,
|
|
308
|
+
"sortText": "01_urldecode"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"label": "base64_encode",
|
|
312
|
+
"kind": 1,
|
|
313
|
+
"detail": "Encode data with Base64",
|
|
314
|
+
"documentation": { "value": "Encodes the given data with Base64.\n\n```php\n$encoded = base64_encode('Hello World');\n$encoded = base64_encode($binaryData);\n```" },
|
|
315
|
+
"insertText": "base64_encode(${1:\\$data})",
|
|
316
|
+
"insertTextRules": 4,
|
|
317
|
+
"sortText": "01_base64_encode"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"label": "base64_decode",
|
|
321
|
+
"kind": 1,
|
|
322
|
+
"detail": "Decode Base64-encoded data",
|
|
323
|
+
"documentation": { "value": "Decodes a Base64-encoded string.\n\n```php\n$decoded = base64_decode($encoded);\n$data = base64_decode($base64String, true);\n```" },
|
|
324
|
+
"insertText": "base64_decode(${1:\\$data})",
|
|
325
|
+
"insertTextRules": 4,
|
|
326
|
+
"sortText": "01_base64_decode"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"label": "md5",
|
|
330
|
+
"kind": 1,
|
|
331
|
+
"detail": "Calculate the MD5 hash of a string",
|
|
332
|
+
"documentation": { "value": "Calculates the MD5 hash of a string and returns a 32-character hexadecimal number.\n\n```php\n$hash = md5('password');\n$hash = md5($data, true); // raw binary\n```" },
|
|
333
|
+
"insertText": "md5(${1:\\$string})",
|
|
334
|
+
"insertTextRules": 4,
|
|
335
|
+
"sortText": "01_md5"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"label": "sha1",
|
|
339
|
+
"kind": 1,
|
|
340
|
+
"detail": "Calculate the SHA-1 hash of a string",
|
|
341
|
+
"documentation": { "value": "Calculates the SHA-1 hash of a string.\n\n```php\n$hash = sha1('data');\n$hash = sha1($data, true); // raw binary\n```" },
|
|
342
|
+
"insertText": "sha1(${1:\\$string})",
|
|
343
|
+
"insertTextRules": 4,
|
|
344
|
+
"sortText": "01_sha1"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"label": "number_format",
|
|
348
|
+
"kind": 1,
|
|
349
|
+
"detail": "Format a number with grouped thousands",
|
|
350
|
+
"documentation": { "value": "Formats a number with grouped thousands and decimal places.\n\n```php\n$formatted = number_format(1234567.891, 2, '.', ','); // '1,234,567.89'\n$formatted = number_format($price, 2);\n```" },
|
|
351
|
+
"insertText": "number_format(${1:\\$number}, ${2:2}, ${3:'.'}, ${4:','})",
|
|
352
|
+
"insertTextRules": 4,
|
|
353
|
+
"sortText": "01_number_format"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"label": "array_push",
|
|
357
|
+
"kind": 1,
|
|
358
|
+
"detail": "Push elements onto end of array",
|
|
359
|
+
"documentation": { "value": "Pushes one or more elements onto the end of an array.\n\n```php\narray_push($stack, 'apple', 'banana');\n$arr[] = 'value'; // shorthand for single push\n```" },
|
|
360
|
+
"insertText": "array_push(${1:\\$array}, ${2:\\$value})",
|
|
361
|
+
"insertTextRules": 4,
|
|
362
|
+
"sortText": "02_array_push"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"label": "array_pop",
|
|
366
|
+
"kind": 1,
|
|
367
|
+
"detail": "Pop the last element off an array",
|
|
368
|
+
"documentation": { "value": "Pops and returns the last element of the array, shortening it by one.\n\n```php\n$last = array_pop($stack);\n$item = array_pop($arr);\n```" },
|
|
369
|
+
"insertText": "array_pop(${1:\\$array})",
|
|
370
|
+
"insertTextRules": 4,
|
|
371
|
+
"sortText": "02_array_pop"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"label": "array_shift",
|
|
375
|
+
"kind": 1,
|
|
376
|
+
"detail": "Shift the first element off an array",
|
|
377
|
+
"documentation": { "value": "Shifts the first value of the array off and returns it, shortening the array by one.\n\n```php\n$first = array_shift($queue);\n```" },
|
|
378
|
+
"insertText": "array_shift(${1:\\$array})",
|
|
379
|
+
"insertTextRules": 4,
|
|
380
|
+
"sortText": "02_array_shift"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"label": "array_unshift",
|
|
384
|
+
"kind": 1,
|
|
385
|
+
"detail": "Prepend elements to the beginning of array",
|
|
386
|
+
"documentation": { "value": "Prepends one or more elements to the beginning of an array.\n\n```php\narray_unshift($arr, 'first');\narray_unshift($arr, 'a', 'b');\n```" },
|
|
387
|
+
"insertText": "array_unshift(${1:\\$array}, ${2:\\$value})",
|
|
388
|
+
"insertTextRules": 4,
|
|
389
|
+
"sortText": "02_array_unshift"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"label": "array_merge",
|
|
393
|
+
"kind": 1,
|
|
394
|
+
"detail": "Merge one or more arrays",
|
|
395
|
+
"documentation": { "value": "Merges one or more arrays. Values with numeric keys are re-indexed; string keys are overwritten.\n\n```php\n$merged = array_merge($arr1, $arr2);\n$all = array_merge($a, $b, $c);\n```" },
|
|
396
|
+
"insertText": "array_merge(${1:\\$array1}, ${2:\\$array2})",
|
|
397
|
+
"insertTextRules": 4,
|
|
398
|
+
"sortText": "02_array_merge"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"label": "array_combine",
|
|
402
|
+
"kind": 1,
|
|
403
|
+
"detail": "Create array using keys and values arrays",
|
|
404
|
+
"documentation": { "value": "Creates an array by using one array for keys and another for its values.\n\n```php\n$result = array_combine(['a', 'b', 'c'], [1, 2, 3]);\n// ['a' => 1, 'b' => 2, 'c' => 3]\n```" },
|
|
405
|
+
"insertText": "array_combine(${1:\\$keys}, ${2:\\$values})",
|
|
406
|
+
"insertTextRules": 4,
|
|
407
|
+
"sortText": "02_array_combine"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"label": "array_map",
|
|
411
|
+
"kind": 1,
|
|
412
|
+
"detail": "Apply callback to each element",
|
|
413
|
+
"documentation": { "value": "Applies the callback to the elements of the given arrays and returns a new array.\n\n```php\n$doubled = array_map(fn($n) => $n * 2, [1, 2, 3]);\n$upper = array_map('strtoupper', $words);\n```" },
|
|
414
|
+
"insertText": "array_map(${1:fn(\\$item) => \\$item}, ${2:\\$array})",
|
|
415
|
+
"insertTextRules": 4,
|
|
416
|
+
"sortText": "02_array_map"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"label": "array_filter",
|
|
420
|
+
"kind": 1,
|
|
421
|
+
"detail": "Filter array elements using a callback",
|
|
422
|
+
"documentation": { "value": "Filters elements of an array using a callback function.\n\n```php\n$even = array_filter([1,2,3,4], fn($n) => $n % 2 === 0);\n$nonEmpty = array_filter($arr); // removes falsy values\n```" },
|
|
423
|
+
"insertText": "array_filter(${1:\\$array}, ${2:fn(\\$item) => \\$item})",
|
|
424
|
+
"insertTextRules": 4,
|
|
425
|
+
"sortText": "02_array_filter"
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"label": "array_reduce",
|
|
429
|
+
"kind": 1,
|
|
430
|
+
"detail": "Reduce array to a single value",
|
|
431
|
+
"documentation": { "value": "Iteratively reduces the array to a single value using a callback function.\n\n```php\n$sum = array_reduce([1,2,3], fn($carry, $item) => $carry + $item, 0);\n```" },
|
|
432
|
+
"insertText": "array_reduce(${1:\\$array}, fn(\\$carry, \\$item) => ${2:\\$carry}, ${3:null})",
|
|
433
|
+
"insertTextRules": 4,
|
|
434
|
+
"sortText": "02_array_reduce"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"label": "array_keys",
|
|
438
|
+
"kind": 1,
|
|
439
|
+
"detail": "Return all keys of an array",
|
|
440
|
+
"documentation": { "value": "Returns all the keys or a subset of keys of an array.\n\n```php\n$keys = array_keys(['a' => 1, 'b' => 2]); // ['a', 'b']\n$keys = array_keys($arr, 'search_value');\n```" },
|
|
441
|
+
"insertText": "array_keys(${1:\\$array})",
|
|
442
|
+
"insertTextRules": 4,
|
|
443
|
+
"sortText": "02_array_keys"
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
"label": "array_values",
|
|
447
|
+
"kind": 1,
|
|
448
|
+
"detail": "Return all values of an array",
|
|
449
|
+
"documentation": { "value": "Returns all the values of an array with numeric indexing.\n\n```php\n$values = array_values(['a' => 1, 'b' => 2]); // [1, 2]\n$reindexed = array_values($filtered);\n```" },
|
|
450
|
+
"insertText": "array_values(${1:\\$array})",
|
|
451
|
+
"insertTextRules": 4,
|
|
452
|
+
"sortText": "02_array_values"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"label": "array_unique",
|
|
456
|
+
"kind": 1,
|
|
457
|
+
"detail": "Remove duplicate values from array",
|
|
458
|
+
"documentation": { "value": "Removes duplicate values from an array.\n\n```php\n$unique = array_unique([1, 2, 2, 3, 3]); // [1, 2, 3]\n```" },
|
|
459
|
+
"insertText": "array_unique(${1:\\$array})",
|
|
460
|
+
"insertTextRules": 4,
|
|
461
|
+
"sortText": "02_array_unique"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
"label": "array_reverse",
|
|
465
|
+
"kind": 1,
|
|
466
|
+
"detail": "Return array in reverse order",
|
|
467
|
+
"documentation": { "value": "Returns an array with elements in reverse order.\n\n```php\n$reversed = array_reverse([1, 2, 3]); // [3, 2, 1]\n$reversed = array_reverse($arr, true); // preserve keys\n```" },
|
|
468
|
+
"insertText": "array_reverse(${1:\\$array})",
|
|
469
|
+
"insertTextRules": 4,
|
|
470
|
+
"sortText": "02_array_reverse"
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"label": "array_slice",
|
|
474
|
+
"kind": 1,
|
|
475
|
+
"detail": "Extract a slice of the array",
|
|
476
|
+
"documentation": { "value": "Extracts a slice of the array.\n\n```php\n$slice = array_slice([1,2,3,4,5], 1, 3); // [2,3,4]\n$last3 = array_slice($arr, -3);\n```" },
|
|
477
|
+
"insertText": "array_slice(${1:\\$array}, ${2:offset}, ${3:length})",
|
|
478
|
+
"insertTextRules": 4,
|
|
479
|
+
"sortText": "02_array_slice"
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"label": "array_splice",
|
|
483
|
+
"kind": 1,
|
|
484
|
+
"detail": "Remove and replace part of an array",
|
|
485
|
+
"documentation": { "value": "Removes a portion of the array and replaces it with something else.\n\n```php\narray_splice($arr, 2, 1); // remove 1 element at index 2\narray_splice($arr, 1, 0, ['inserted']);\n```" },
|
|
486
|
+
"insertText": "array_splice(${1:\\$array}, ${2:offset}, ${3:length})",
|
|
487
|
+
"insertTextRules": 4,
|
|
488
|
+
"sortText": "02_array_splice"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"label": "array_search",
|
|
492
|
+
"kind": 1,
|
|
493
|
+
"detail": "Search array for a value",
|
|
494
|
+
"documentation": { "value": "Searches the array for a given value and returns the corresponding key if found.\n\n```php\n$key = array_search('apple', $fruits);\nif (($key = array_search($val, $arr)) !== false) { ... }\n```" },
|
|
495
|
+
"insertText": "array_search(${1:\\$needle}, ${2:\\$haystack})",
|
|
496
|
+
"insertTextRules": 4,
|
|
497
|
+
"sortText": "02_array_search"
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"label": "array_flip",
|
|
501
|
+
"kind": 1,
|
|
502
|
+
"detail": "Exchange keys and values",
|
|
503
|
+
"documentation": { "value": "Exchanges all keys with their associated values in an array.\n\n```php\n$flipped = array_flip(['a' => 1, 'b' => 2]); // [1 => 'a', 2 => 'b']\n```" },
|
|
504
|
+
"insertText": "array_flip(${1:\\$array})",
|
|
505
|
+
"insertTextRules": 4,
|
|
506
|
+
"sortText": "02_array_flip"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
"label": "array_chunk",
|
|
510
|
+
"kind": 1,
|
|
511
|
+
"detail": "Split array into chunks",
|
|
512
|
+
"documentation": { "value": "Splits an array into chunks of the specified size.\n\n```php\n$chunks = array_chunk([1,2,3,4,5], 2); // [[1,2],[3,4],[5]]\n$pages = array_chunk($items, 10, true);\n```" },
|
|
513
|
+
"insertText": "array_chunk(${1:\\$array}, ${2:size})",
|
|
514
|
+
"insertTextRules": 4,
|
|
515
|
+
"sortText": "02_array_chunk"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
"label": "array_column",
|
|
519
|
+
"kind": 1,
|
|
520
|
+
"detail": "Return values from a single column",
|
|
521
|
+
"documentation": { "value": "Returns the values from a single column in a multi-dimensional array.\n\n```php\n$names = array_column($users, 'name');\n$indexed = array_column($records, 'value', 'key');\n```" },
|
|
522
|
+
"insertText": "array_column(${1:\\$array}, ${2:'column_key'})",
|
|
523
|
+
"insertTextRules": 4,
|
|
524
|
+
"sortText": "02_array_column"
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
"label": "array_diff",
|
|
528
|
+
"kind": 1,
|
|
529
|
+
"detail": "Compute the difference of arrays",
|
|
530
|
+
"documentation": { "value": "Computes the difference of arrays using values for comparison.\n\n```php\n$diff = array_diff([1,2,3,4], [2,4]); // [1, 3]\n```" },
|
|
531
|
+
"insertText": "array_diff(${1:\\$array1}, ${2:\\$array2})",
|
|
532
|
+
"insertTextRules": 4,
|
|
533
|
+
"sortText": "02_array_diff"
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
"label": "array_intersect",
|
|
537
|
+
"kind": 1,
|
|
538
|
+
"detail": "Compute the intersection of arrays",
|
|
539
|
+
"documentation": { "value": "Computes the intersection of arrays using values for comparison.\n\n```php\n$common = array_intersect([1,2,3], [2,3,4]); // [2, 3]\n```" },
|
|
540
|
+
"insertText": "array_intersect(${1:\\$array1}, ${2:\\$array2})",
|
|
541
|
+
"insertTextRules": 4,
|
|
542
|
+
"sortText": "02_array_intersect"
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
"label": "in_array",
|
|
546
|
+
"kind": 1,
|
|
547
|
+
"detail": "Check if a value exists in an array",
|
|
548
|
+
"documentation": { "value": "Checks if a value exists in an array.\n\n```php\nif (in_array('apple', $fruits)) { ... }\nif (in_array($val, $arr, true)) { ... } // strict comparison\n```" },
|
|
549
|
+
"insertText": "in_array(${1:\\$needle}, ${2:\\$haystack})",
|
|
550
|
+
"insertTextRules": 4,
|
|
551
|
+
"sortText": "02_in_array"
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
"label": "count",
|
|
555
|
+
"kind": 1,
|
|
556
|
+
"detail": "Count elements in array or Countable",
|
|
557
|
+
"documentation": { "value": "Counts all elements in an array or a Countable object.\n\n```php\n$total = count($arr);\n$depth = count($matrix, COUNT_RECURSIVE);\nif (count($items) > 0) { ... }\n```" },
|
|
558
|
+
"insertText": "count(${1:\\$array})",
|
|
559
|
+
"insertTextRules": 4,
|
|
560
|
+
"sortText": "02_count"
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"label": "sort",
|
|
564
|
+
"kind": 1,
|
|
565
|
+
"detail": "Sort an array in ascending order",
|
|
566
|
+
"documentation": { "value": "Sorts an array in place in ascending order.\n\n```php\nsort($arr);\nsort($numbers, SORT_NUMERIC);\n```" },
|
|
567
|
+
"insertText": "sort(${1:\\$array})",
|
|
568
|
+
"insertTextRules": 4,
|
|
569
|
+
"sortText": "02_sort"
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
"label": "rsort",
|
|
573
|
+
"kind": 1,
|
|
574
|
+
"detail": "Sort an array in descending order",
|
|
575
|
+
"documentation": { "value": "Sorts an array in place in descending order.\n\n```php\nrsort($arr);\nrsort($numbers, SORT_NUMERIC);\n```" },
|
|
576
|
+
"insertText": "rsort(${1:\\$array})",
|
|
577
|
+
"insertTextRules": 4,
|
|
578
|
+
"sortText": "02_rsort"
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"label": "asort",
|
|
582
|
+
"kind": 1,
|
|
583
|
+
"detail": "Sort array in ascending order, maintain keys",
|
|
584
|
+
"documentation": { "value": "Sorts an array in ascending order, maintaining key association.\n\n```php\nasort($prices);\n```" },
|
|
585
|
+
"insertText": "asort(${1:\\$array})",
|
|
586
|
+
"insertTextRules": 4,
|
|
587
|
+
"sortText": "02_asort"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
"label": "arsort",
|
|
591
|
+
"kind": 1,
|
|
592
|
+
"detail": "Sort array in descending order, maintain keys",
|
|
593
|
+
"documentation": { "value": "Sorts an array in descending order, maintaining key association.\n\n```php\narsort($prices);\n```" },
|
|
594
|
+
"insertText": "arsort(${1:\\$array})",
|
|
595
|
+
"insertTextRules": 4,
|
|
596
|
+
"sortText": "02_arsort"
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
"label": "ksort",
|
|
600
|
+
"kind": 1,
|
|
601
|
+
"detail": "Sort array by key in ascending order",
|
|
602
|
+
"documentation": { "value": "Sorts an array by key in ascending order.\n\n```php\nksort($config);\n```" },
|
|
603
|
+
"insertText": "ksort(${1:\\$array})",
|
|
604
|
+
"insertTextRules": 4,
|
|
605
|
+
"sortText": "02_ksort"
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
"label": "krsort",
|
|
609
|
+
"kind": 1,
|
|
610
|
+
"detail": "Sort array by key in descending order",
|
|
611
|
+
"documentation": { "value": "Sorts an array by key in descending order.\n\n```php\nkrsort($config);\n```" },
|
|
612
|
+
"insertText": "krsort(${1:\\$array})",
|
|
613
|
+
"insertTextRules": 4,
|
|
614
|
+
"sortText": "02_krsort"
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"label": "usort",
|
|
618
|
+
"kind": 1,
|
|
619
|
+
"detail": "Sort array using a comparison function",
|
|
620
|
+
"documentation": { "value": "Sorts an array by values using a user-defined comparison function.\n\n```php\nusort($arr, fn($a, $b) => $a - $b);\nusort($users, fn($a, $b) => strcmp($a['name'], $b['name']));\n```" },
|
|
621
|
+
"insertText": "usort(${1:\\$array}, fn(\\$a, \\$b) => ${2:\\$a - \\$b})",
|
|
622
|
+
"insertTextRules": 4,
|
|
623
|
+
"sortText": "02_usort"
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
"label": "array_walk",
|
|
627
|
+
"kind": 1,
|
|
628
|
+
"detail": "Apply callback to each array element",
|
|
629
|
+
"documentation": { "value": "Applies a user-supplied function to every member of an array (by reference).\n\n```php\narray_walk($arr, function(&$val, $key) { $val = strtoupper($val); });\n```" },
|
|
630
|
+
"insertText": "array_walk(${1:\\$array}, function(&\\$value, \\$key) {\n\t${2}\n})",
|
|
631
|
+
"insertTextRules": 4,
|
|
632
|
+
"sortText": "02_array_walk"
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
"label": "array_key_exists",
|
|
636
|
+
"kind": 1,
|
|
637
|
+
"detail": "Check if key exists in array",
|
|
638
|
+
"documentation": { "value": "Checks if the given key or index exists in the array.\n\n```php\nif (array_key_exists('name', $data)) { ... }\nif (array_key_exists(0, $arr)) { ... }\n```" },
|
|
639
|
+
"insertText": "array_key_exists(${1:'key'}, ${2:\\$array})",
|
|
640
|
+
"insertTextRules": 4,
|
|
641
|
+
"sortText": "02_array_key_exists"
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
"label": "array_fill",
|
|
645
|
+
"kind": 1,
|
|
646
|
+
"detail": "Fill an array with values",
|
|
647
|
+
"documentation": { "value": "Fills an array with values, specifying start index and number of entries.\n\n```php\n$filled = array_fill(0, 5, 'default'); // 5 elements of 'default'\n$zeros = array_fill(0, 10, 0);\n```" },
|
|
648
|
+
"insertText": "array_fill(${1:0}, ${2:count}, ${3:\\$value})",
|
|
649
|
+
"insertTextRules": 4,
|
|
650
|
+
"sortText": "02_array_fill"
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
"label": "compact",
|
|
654
|
+
"kind": 1,
|
|
655
|
+
"detail": "Create array from variables and their values",
|
|
656
|
+
"documentation": { "value": "Creates an array containing variables and their values.\n\n```php\n$name = 'John';\n$age = 30;\n$data = compact('name', 'age'); // ['name' => 'John', 'age' => 30]\n```" },
|
|
657
|
+
"insertText": "compact(${1:'var1'}, ${2:'var2'})",
|
|
658
|
+
"insertTextRules": 4,
|
|
659
|
+
"sortText": "02_compact"
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
"label": "extract",
|
|
663
|
+
"kind": 1,
|
|
664
|
+
"detail": "Import variables from an array",
|
|
665
|
+
"documentation": { "value": "Import variables into the current symbol table from an array.\n\n```php\n$data = ['name' => 'John', 'age' => 30];\nextract($data);\necho $name; // 'John'\n```" },
|
|
666
|
+
"insertText": "extract(${1:\\$array})",
|
|
667
|
+
"insertTextRules": 4,
|
|
668
|
+
"sortText": "02_extract"
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
"label": "range",
|
|
672
|
+
"kind": 1,
|
|
673
|
+
"detail": "Create an array of sequential values",
|
|
674
|
+
"documentation": { "value": "Creates an array containing a range of elements.\n\n```php\n$nums = range(1, 10); // [1,2,3,...,10]\n$letters = range('a', 'z');\n$evens = range(0, 20, 2);\n```" },
|
|
675
|
+
"insertText": "range(${1:start}, ${2:end})",
|
|
676
|
+
"insertTextRules": 4,
|
|
677
|
+
"sortText": "02_range"
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
"label": "array_sum",
|
|
681
|
+
"kind": 1,
|
|
682
|
+
"detail": "Calculate sum of array values",
|
|
683
|
+
"documentation": { "value": "Calculates the sum of values in an array.\n\n```php\n$total = array_sum([1, 2, 3]); // 6\n$total = array_sum($prices);\n```" },
|
|
684
|
+
"insertText": "array_sum(${1:\\$array})",
|
|
685
|
+
"insertTextRules": 4,
|
|
686
|
+
"sortText": "02_array_sum"
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
"label": "array_product",
|
|
690
|
+
"kind": 1,
|
|
691
|
+
"detail": "Calculate product of array values",
|
|
692
|
+
"documentation": { "value": "Calculates the product of values in an array.\n\n```php\n$product = array_product([2, 3, 4]); // 24\n```" },
|
|
693
|
+
"insertText": "array_product(${1:\\$array})",
|
|
694
|
+
"insertTextRules": 4,
|
|
695
|
+
"sortText": "02_array_product"
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
"label": "array_count_values",
|
|
699
|
+
"kind": 1,
|
|
700
|
+
"detail": "Count occurrences of each value",
|
|
701
|
+
"documentation": { "value": "Counts all the values of an array and returns an associative array.\n\n```php\n$counts = array_count_values(['a','b','a','c','b','a']);\n// ['a' => 3, 'b' => 2, 'c' => 1]\n```" },
|
|
702
|
+
"insertText": "array_count_values(${1:\\$array})",
|
|
703
|
+
"insertTextRules": 4,
|
|
704
|
+
"sortText": "02_array_count_values"
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
"label": "file_get_contents",
|
|
708
|
+
"kind": 1,
|
|
709
|
+
"detail": "Read entire file into a string",
|
|
710
|
+
"documentation": { "value": "Reads entire file into a string. Preferred way to read the contents of a file into a string.\n\n```php\n$content = file_get_contents('file.txt');\n$html = file_get_contents('https://example.com');\n$json = file_get_contents('data.json');\n```" },
|
|
711
|
+
"insertText": "file_get_contents(${1:'filename'})",
|
|
712
|
+
"insertTextRules": 4,
|
|
713
|
+
"sortText": "03_file_get_contents"
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
"label": "file_put_contents",
|
|
717
|
+
"kind": 1,
|
|
718
|
+
"detail": "Write data to a file",
|
|
719
|
+
"documentation": { "value": "Write data to a file. Identical to calling fopen(), fwrite(), and fclose() successively.\n\n```php\nfile_put_contents('file.txt', $data);\nfile_put_contents('log.txt', $msg, FILE_APPEND);\n```" },
|
|
720
|
+
"insertText": "file_put_contents(${1:'filename'}, ${2:\\$data})",
|
|
721
|
+
"insertTextRules": 4,
|
|
722
|
+
"sortText": "03_file_put_contents"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"label": "fopen",
|
|
726
|
+
"kind": 1,
|
|
727
|
+
"detail": "Open file or URL",
|
|
728
|
+
"documentation": { "value": "Opens a file or URL and returns a file pointer resource.\n\n```php\n$fp = fopen('file.txt', 'r');\n$fp = fopen('output.csv', 'w');\n$fp = fopen('log.txt', 'a');\n```" },
|
|
729
|
+
"insertText": "fopen(${1:'filename'}, ${2:'r'})",
|
|
730
|
+
"insertTextRules": 4,
|
|
731
|
+
"sortText": "03_fopen"
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
"label": "fclose",
|
|
735
|
+
"kind": 1,
|
|
736
|
+
"detail": "Close an open file pointer",
|
|
737
|
+
"documentation": { "value": "Closes an open file pointer.\n\n```php\nfclose($fp);\n```" },
|
|
738
|
+
"insertText": "fclose(${1:\\$handle})",
|
|
739
|
+
"insertTextRules": 4,
|
|
740
|
+
"sortText": "03_fclose"
|
|
741
|
+
},
|
|
742
|
+
{
|
|
743
|
+
"label": "fread",
|
|
744
|
+
"kind": 1,
|
|
745
|
+
"detail": "Binary-safe file read",
|
|
746
|
+
"documentation": { "value": "Reads up to length bytes from a file pointer.\n\n```php\n$data = fread($fp, filesize('file.txt'));\n$chunk = fread($handle, 1024);\n```" },
|
|
747
|
+
"insertText": "fread(${1:\\$handle}, ${2:length})",
|
|
748
|
+
"insertTextRules": 4,
|
|
749
|
+
"sortText": "03_fread"
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
"label": "fwrite",
|
|
753
|
+
"kind": 1,
|
|
754
|
+
"detail": "Binary-safe file write",
|
|
755
|
+
"documentation": { "value": "Writes the contents of string to the file stream pointed to by handle.\n\n```php\nfwrite($fp, 'Hello World');\nfwrite($handle, $data, strlen($data));\n```" },
|
|
756
|
+
"insertText": "fwrite(${1:\\$handle}, ${2:\\$string})",
|
|
757
|
+
"insertTextRules": 4,
|
|
758
|
+
"sortText": "03_fwrite"
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
"label": "fgets",
|
|
762
|
+
"kind": 1,
|
|
763
|
+
"detail": "Get line from file pointer",
|
|
764
|
+
"documentation": { "value": "Gets a line from file pointer.\n\n```php\nwhile (($line = fgets($fp)) !== false) {\n echo $line;\n}\n```" },
|
|
765
|
+
"insertText": "fgets(${1:\\$handle})",
|
|
766
|
+
"insertTextRules": 4,
|
|
767
|
+
"sortText": "03_fgets"
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
"label": "file_exists",
|
|
771
|
+
"kind": 1,
|
|
772
|
+
"detail": "Check whether a file or directory exists",
|
|
773
|
+
"documentation": { "value": "Checks whether a file or directory exists.\n\n```php\nif (file_exists('config.php')) { ... }\nif (file_exists($path)) { ... }\n```" },
|
|
774
|
+
"insertText": "file_exists(${1:'filename'})",
|
|
775
|
+
"insertTextRules": 4,
|
|
776
|
+
"sortText": "03_file_exists"
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
"label": "is_file",
|
|
780
|
+
"kind": 1,
|
|
781
|
+
"detail": "Check if path is a regular file",
|
|
782
|
+
"documentation": { "value": "Tells whether the given filename is a regular file.\n\n```php\nif (is_file($path)) { ... }\n```" },
|
|
783
|
+
"insertText": "is_file(${1:\\$filename})",
|
|
784
|
+
"insertTextRules": 4,
|
|
785
|
+
"sortText": "03_is_file"
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
"label": "is_dir",
|
|
789
|
+
"kind": 1,
|
|
790
|
+
"detail": "Check if path is a directory",
|
|
791
|
+
"documentation": { "value": "Tells whether the given filename is a directory.\n\n```php\nif (is_dir($path)) { ... }\n```" },
|
|
792
|
+
"insertText": "is_dir(${1:\\$path})",
|
|
793
|
+
"insertTextRules": 4,
|
|
794
|
+
"sortText": "03_is_dir"
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
"label": "mkdir",
|
|
798
|
+
"kind": 1,
|
|
799
|
+
"detail": "Create a directory",
|
|
800
|
+
"documentation": { "value": "Creates a directory.\n\n```php\nmkdir('new_folder');\nmkdir('path/to/dir', 0755, true); // recursive\n```" },
|
|
801
|
+
"insertText": "mkdir(${1:'directory'}, ${2:0755}, ${3:true})",
|
|
802
|
+
"insertTextRules": 4,
|
|
803
|
+
"sortText": "03_mkdir"
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
"label": "unlink",
|
|
807
|
+
"kind": 1,
|
|
808
|
+
"detail": "Delete a file",
|
|
809
|
+
"documentation": { "value": "Deletes a file.\n\n```php\nunlink('temp.txt');\nif (file_exists($file)) { unlink($file); }\n```" },
|
|
810
|
+
"insertText": "unlink(${1:'filename'})",
|
|
811
|
+
"insertTextRules": 4,
|
|
812
|
+
"sortText": "03_unlink"
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
"label": "glob",
|
|
816
|
+
"kind": 1,
|
|
817
|
+
"detail": "Find pathnames matching a pattern",
|
|
818
|
+
"documentation": { "value": "Finds pathnames matching a pattern.\n\n```php\n$phpFiles = glob('*.php');\n$files = glob('src/**/*.php');\n```" },
|
|
819
|
+
"insertText": "glob(${1:'pattern'})",
|
|
820
|
+
"insertTextRules": 4,
|
|
821
|
+
"sortText": "03_glob"
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
"label": "scandir",
|
|
825
|
+
"kind": 1,
|
|
826
|
+
"detail": "List files and directories inside a path",
|
|
827
|
+
"documentation": { "value": "Lists files and directories inside the specified path.\n\n```php\n$files = scandir('/path/to/dir');\n$files = scandir('.', SCANDIR_SORT_DESCENDING);\n```" },
|
|
828
|
+
"insertText": "scandir(${1:'directory'})",
|
|
829
|
+
"insertTextRules": 4,
|
|
830
|
+
"sortText": "03_scandir"
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
"label": "basename",
|
|
834
|
+
"kind": 1,
|
|
835
|
+
"detail": "Return filename component of path",
|
|
836
|
+
"documentation": { "value": "Returns the trailing name component of a file path.\n\n```php\n$name = basename('/var/www/index.php'); // 'index.php'\n$name = basename($path, '.php'); // without extension\n```" },
|
|
837
|
+
"insertText": "basename(${1:\\$path})",
|
|
838
|
+
"insertTextRules": 4,
|
|
839
|
+
"sortText": "03_basename"
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
"label": "dirname",
|
|
843
|
+
"kind": 1,
|
|
844
|
+
"detail": "Return directory name component of path",
|
|
845
|
+
"documentation": { "value": "Returns the parent directory's path.\n\n```php\n$dir = dirname('/var/www/index.php'); // '/var/www'\n$dir = dirname(__FILE__);\n```" },
|
|
846
|
+
"insertText": "dirname(${1:\\$path})",
|
|
847
|
+
"insertTextRules": 4,
|
|
848
|
+
"sortText": "03_dirname"
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
"label": "pathinfo",
|
|
852
|
+
"kind": 1,
|
|
853
|
+
"detail": "Return information about a file path",
|
|
854
|
+
"documentation": { "value": "Returns information about a file path as an associative array.\n\n```php\n$info = pathinfo('/var/www/index.php');\n// ['dirname'=>'/var/www','basename'=>'index.php','extension'=>'php','filename'=>'index']\n```" },
|
|
855
|
+
"insertText": "pathinfo(${1:\\$path})",
|
|
856
|
+
"insertTextRules": 4,
|
|
857
|
+
"sortText": "03_pathinfo"
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
"label": "realpath",
|
|
861
|
+
"kind": 1,
|
|
862
|
+
"detail": "Return canonicalized absolute pathname",
|
|
863
|
+
"documentation": { "value": "Returns the canonicalized absolute pathname.\n\n```php\n$real = realpath('./relative/path');\n$real = realpath(__DIR__ . '/../config');\n```" },
|
|
864
|
+
"insertText": "realpath(${1:\\$path})",
|
|
865
|
+
"insertTextRules": 4,
|
|
866
|
+
"sortText": "03_realpath"
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
"label": "json_encode",
|
|
870
|
+
"kind": 1,
|
|
871
|
+
"detail": "Encode value as JSON",
|
|
872
|
+
"documentation": { "value": "Returns the JSON representation of a value.\n\n```php\n$json = json_encode(['name' => 'John', 'age' => 30]);\n$json = json_encode($data, JSON_PRETTY_PRINT);\n$json = json_encode($obj, JSON_UNESCAPED_UNICODE);\n```" },
|
|
873
|
+
"insertText": "json_encode(${1:\\$value})",
|
|
874
|
+
"insertTextRules": 4,
|
|
875
|
+
"sortText": "04_json_encode"
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
"label": "json_decode",
|
|
879
|
+
"kind": 1,
|
|
880
|
+
"detail": "Decode a JSON string",
|
|
881
|
+
"documentation": { "value": "Takes a JSON encoded string and converts it into a PHP variable.\n\n```php\n$data = json_decode($json, true); // associative array\n$obj = json_decode($json); // stdClass object\n$data = json_decode($json, true, 512, JSON_THROW_ON_ERROR);\n```" },
|
|
882
|
+
"insertText": "json_decode(${1:\\$json}, ${2:true})",
|
|
883
|
+
"insertTextRules": 4,
|
|
884
|
+
"sortText": "04_json_decode"
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
"label": "abs",
|
|
888
|
+
"kind": 1,
|
|
889
|
+
"detail": "Absolute value",
|
|
890
|
+
"documentation": { "value": "Returns the absolute value of a number.\n\n```php\n$abs = abs(-5); // 5\n$abs = abs($number);\n```" },
|
|
891
|
+
"insertText": "abs(${1:\\$number})",
|
|
892
|
+
"insertTextRules": 4,
|
|
893
|
+
"sortText": "05_abs"
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
"label": "ceil",
|
|
897
|
+
"kind": 1,
|
|
898
|
+
"detail": "Round fractions up",
|
|
899
|
+
"documentation": { "value": "Returns the next highest integer value by rounding up.\n\n```php\n$rounded = ceil(4.3); // 5\n$pages = ceil($total / $perPage);\n```" },
|
|
900
|
+
"insertText": "ceil(${1:\\$number})",
|
|
901
|
+
"insertTextRules": 4,
|
|
902
|
+
"sortText": "05_ceil"
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
"label": "floor",
|
|
906
|
+
"kind": 1,
|
|
907
|
+
"detail": "Round fractions down",
|
|
908
|
+
"documentation": { "value": "Returns the next lowest integer value by rounding down.\n\n```php\n$rounded = floor(4.9); // 4\n```" },
|
|
909
|
+
"insertText": "floor(${1:\\$number})",
|
|
910
|
+
"insertTextRules": 4,
|
|
911
|
+
"sortText": "05_floor"
|
|
912
|
+
},
|
|
913
|
+
{
|
|
914
|
+
"label": "round",
|
|
915
|
+
"kind": 1,
|
|
916
|
+
"detail": "Round a float",
|
|
917
|
+
"documentation": { "value": "Rounds a float to a specified precision.\n\n```php\n$rounded = round(3.14159, 2); // 3.14\n$rounded = round($value);\n```" },
|
|
918
|
+
"insertText": "round(${1:\\$number}, ${2:0})",
|
|
919
|
+
"insertTextRules": 4,
|
|
920
|
+
"sortText": "05_round"
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
"label": "max",
|
|
924
|
+
"kind": 1,
|
|
925
|
+
"detail": "Find highest value",
|
|
926
|
+
"documentation": { "value": "Finds the highest value from the given values.\n\n```php\n$max = max(1, 5, 3); // 5\n$max = max($arr);\n```" },
|
|
927
|
+
"insertText": "max(${1:\\$values})",
|
|
928
|
+
"insertTextRules": 4,
|
|
929
|
+
"sortText": "05_max"
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
"label": "min",
|
|
933
|
+
"kind": 1,
|
|
934
|
+
"detail": "Find lowest value",
|
|
935
|
+
"documentation": { "value": "Finds the lowest value from the given values.\n\n```php\n$min = min(1, 5, 3); // 1\n$min = min($arr);\n```" },
|
|
936
|
+
"insertText": "min(${1:\\$values})",
|
|
937
|
+
"insertTextRules": 4,
|
|
938
|
+
"sortText": "05_min"
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
"label": "pow",
|
|
942
|
+
"kind": 1,
|
|
943
|
+
"detail": "Exponential expression",
|
|
944
|
+
"documentation": { "value": "Returns base raised to the power of exponent.\n\n```php\n$result = pow(2, 8); // 256\n$result = 2 ** 8; // preferred syntax\n```" },
|
|
945
|
+
"insertText": "pow(${1:\\$base}, ${2:\\$exponent})",
|
|
946
|
+
"insertTextRules": 4,
|
|
947
|
+
"sortText": "05_pow"
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
"label": "sqrt",
|
|
951
|
+
"kind": 1,
|
|
952
|
+
"detail": "Square root",
|
|
953
|
+
"documentation": { "value": "Returns the square root of a number.\n\n```php\n$root = sqrt(16); // 4\n$root = sqrt($number);\n```" },
|
|
954
|
+
"insertText": "sqrt(${1:\\$number})",
|
|
955
|
+
"insertTextRules": 4,
|
|
956
|
+
"sortText": "05_sqrt"
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
"label": "rand",
|
|
960
|
+
"kind": 1,
|
|
961
|
+
"detail": "Generate a random integer",
|
|
962
|
+
"documentation": { "value": "Generates a random integer.\n\n```php\n$num = rand(); // random int\n$num = rand(1, 100); // between 1 and 100\n```" },
|
|
963
|
+
"insertText": "rand(${1:min}, ${2:max})",
|
|
964
|
+
"insertTextRules": 4,
|
|
965
|
+
"sortText": "05_rand"
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
"label": "random_int",
|
|
969
|
+
"kind": 1,
|
|
970
|
+
"detail": "Generate cryptographically secure random integer",
|
|
971
|
+
"documentation": { "value": "Generates cryptographically secure pseudo-random integers.\n\n```php\n$num = random_int(1, 100);\n$token = random_int(100000, 999999);\n```" },
|
|
972
|
+
"insertText": "random_int(${1:min}, ${2:max})",
|
|
973
|
+
"insertTextRules": 4,
|
|
974
|
+
"sortText": "05_random_int"
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
"label": "isset",
|
|
978
|
+
"kind": 14,
|
|
979
|
+
"detail": "Determine if a variable is set and is not null",
|
|
980
|
+
"documentation": { "value": "Determines if a variable is declared and is different than null.\n\n```php\nif (isset($var)) { ... }\nif (isset($arr['key'])) { ... }\nif (isset($a, $b, $c)) { ... } // all must be set\n```" },
|
|
981
|
+
"insertText": "isset(${1:\\$var})",
|
|
982
|
+
"insertTextRules": 4,
|
|
983
|
+
"sortText": "06_isset"
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
"label": "unset",
|
|
987
|
+
"kind": 14,
|
|
988
|
+
"detail": "Unset a given variable",
|
|
989
|
+
"documentation": { "value": "Destroys the specified variables.\n\n```php\nunset($var);\nunset($arr['key']);\nunset($a, $b, $c);\n```" },
|
|
990
|
+
"insertText": "unset(${1:\\$var});",
|
|
991
|
+
"insertTextRules": 4,
|
|
992
|
+
"sortText": "06_unset"
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
"label": "empty",
|
|
996
|
+
"kind": 14,
|
|
997
|
+
"detail": "Determine whether a variable is empty",
|
|
998
|
+
"documentation": { "value": "Determines whether a variable is considered empty. A variable is empty if it doesn't exist or its value equals false.\n\n```php\nif (empty($var)) { ... }\nif (!empty($arr)) { ... }\n```" },
|
|
999
|
+
"insertText": "empty(${1:\\$var})",
|
|
1000
|
+
"insertTextRules": 4,
|
|
1001
|
+
"sortText": "06_empty"
|
|
1002
|
+
},
|
|
1003
|
+
{
|
|
1004
|
+
"label": "is_array",
|
|
1005
|
+
"kind": 1,
|
|
1006
|
+
"detail": "Check if variable is an array",
|
|
1007
|
+
"documentation": { "value": "Finds whether the given variable is an array.\n\n```php\nif (is_array($data)) { ... }\n```" },
|
|
1008
|
+
"insertText": "is_array(${1:\\$var})",
|
|
1009
|
+
"insertTextRules": 4,
|
|
1010
|
+
"sortText": "06_is_array"
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
"label": "is_string",
|
|
1014
|
+
"kind": 1,
|
|
1015
|
+
"detail": "Check if variable is a string",
|
|
1016
|
+
"documentation": { "value": "Finds whether the type of a variable is string.\n\n```php\nif (is_string($data)) { ... }\n```" },
|
|
1017
|
+
"insertText": "is_string(${1:\\$var})",
|
|
1018
|
+
"insertTextRules": 4,
|
|
1019
|
+
"sortText": "06_is_string"
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
"label": "is_int",
|
|
1023
|
+
"kind": 1,
|
|
1024
|
+
"detail": "Check if variable is an integer",
|
|
1025
|
+
"documentation": { "value": "Finds whether the type of a variable is integer.\n\n```php\nif (is_int($value)) { ... }\n```" },
|
|
1026
|
+
"insertText": "is_int(${1:\\$var})",
|
|
1027
|
+
"insertTextRules": 4,
|
|
1028
|
+
"sortText": "06_is_int"
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
"label": "is_null",
|
|
1032
|
+
"kind": 1,
|
|
1033
|
+
"detail": "Check if variable is null",
|
|
1034
|
+
"documentation": { "value": "Finds whether the given variable is null.\n\n```php\nif (is_null($value)) { ... }\n```" },
|
|
1035
|
+
"insertText": "is_null(${1:\\$var})",
|
|
1036
|
+
"insertTextRules": 4,
|
|
1037
|
+
"sortText": "06_is_null"
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
"label": "is_numeric",
|
|
1041
|
+
"kind": 1,
|
|
1042
|
+
"detail": "Check if variable is numeric",
|
|
1043
|
+
"documentation": { "value": "Finds whether a variable is a number or a numeric string.\n\n```php\nif (is_numeric($input)) { ... }\nis_numeric('42'); // true\nis_numeric('3.14'); // true\n```" },
|
|
1044
|
+
"insertText": "is_numeric(${1:\\$var})",
|
|
1045
|
+
"insertTextRules": 4,
|
|
1046
|
+
"sortText": "06_is_numeric"
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
"label": "is_bool",
|
|
1050
|
+
"kind": 1,
|
|
1051
|
+
"detail": "Check if variable is a boolean",
|
|
1052
|
+
"documentation": { "value": "Finds out whether a variable is a boolean.\n\n```php\nif (is_bool($value)) { ... }\n```" },
|
|
1053
|
+
"insertText": "is_bool(${1:\\$var})",
|
|
1054
|
+
"insertTextRules": 4,
|
|
1055
|
+
"sortText": "06_is_bool"
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
"label": "gettype",
|
|
1059
|
+
"kind": 1,
|
|
1060
|
+
"detail": "Get the type of a variable",
|
|
1061
|
+
"documentation": { "value": "Gets the type of a variable as a string.\n\n```php\necho gettype(42); // 'integer'\necho gettype([]); // 'array'\n```" },
|
|
1062
|
+
"insertText": "gettype(${1:\\$var})",
|
|
1063
|
+
"insertTextRules": 4,
|
|
1064
|
+
"sortText": "06_gettype"
|
|
1065
|
+
},
|
|
1066
|
+
{
|
|
1067
|
+
"label": "intval",
|
|
1068
|
+
"kind": 1,
|
|
1069
|
+
"detail": "Get integer value of a variable",
|
|
1070
|
+
"documentation": { "value": "Gets the integer value of a variable.\n\n```php\n$int = intval('42'); // 42\n$int = intval('0x1A', 16); // 26\n```" },
|
|
1071
|
+
"insertText": "intval(${1:\\$var})",
|
|
1072
|
+
"insertTextRules": 4,
|
|
1073
|
+
"sortText": "06_intval"
|
|
1074
|
+
},
|
|
1075
|
+
{
|
|
1076
|
+
"label": "floatval",
|
|
1077
|
+
"kind": 1,
|
|
1078
|
+
"detail": "Get float value of a variable",
|
|
1079
|
+
"documentation": { "value": "Gets the float value of a variable.\n\n```php\n$float = floatval('3.14'); // 3.14\n```" },
|
|
1080
|
+
"insertText": "floatval(${1:\\$var})",
|
|
1081
|
+
"insertTextRules": 4,
|
|
1082
|
+
"sortText": "06_floatval"
|
|
1083
|
+
},
|
|
1084
|
+
{
|
|
1085
|
+
"label": "strval",
|
|
1086
|
+
"kind": 1,
|
|
1087
|
+
"detail": "Get string value of a variable",
|
|
1088
|
+
"documentation": { "value": "Gets the string value of a variable.\n\n```php\n$str = strval(42); // '42'\n$str = strval($number);\n```" },
|
|
1089
|
+
"insertText": "strval(${1:\\$var})",
|
|
1090
|
+
"insertTextRules": 4,
|
|
1091
|
+
"sortText": "06_strval"
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
"label": "boolval",
|
|
1095
|
+
"kind": 1,
|
|
1096
|
+
"detail": "Get boolean value of a variable",
|
|
1097
|
+
"documentation": { "value": "Gets the boolean value of a variable.\n\n```php\n$bool = boolval(1); // true\n$bool = boolval(''); // false\n```" },
|
|
1098
|
+
"insertText": "boolval(${1:\\$var})",
|
|
1099
|
+
"insertTextRules": 4,
|
|
1100
|
+
"sortText": "06_boolval"
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
"label": "class",
|
|
1104
|
+
"kind": 7,
|
|
1105
|
+
"detail": "Define a class",
|
|
1106
|
+
"documentation": { "value": "Defines a class with properties, methods, and optional constructor.\n\n```php\nclass User {\n public function __construct(\n private string $name,\n private int $age,\n ) {}\n\n public function getName(): string {\n return $this->name;\n }\n}\n```" },
|
|
1107
|
+
"insertText": "class ${1:ClassName}\n{\n\tpublic function __construct(\n\t\t${2}\n\t) {}\n\n\t${3}\n}",
|
|
1108
|
+
"insertTextRules": 4,
|
|
1109
|
+
"sortText": "07_class"
|
|
1110
|
+
},
|
|
1111
|
+
{
|
|
1112
|
+
"label": "interface",
|
|
1113
|
+
"kind": 7,
|
|
1114
|
+
"detail": "Define an interface",
|
|
1115
|
+
"documentation": { "value": "Defines an interface that classes can implement.\n\n```php\ninterface Loggable {\n public function log(string $message): void;\n}\n```" },
|
|
1116
|
+
"insertText": "interface ${1:InterfaceName}\n{\n\t${2:public function method(): void;}\n}",
|
|
1117
|
+
"insertTextRules": 4,
|
|
1118
|
+
"sortText": "07_interface"
|
|
1119
|
+
},
|
|
1120
|
+
{
|
|
1121
|
+
"label": "trait",
|
|
1122
|
+
"kind": 7,
|
|
1123
|
+
"detail": "Define a trait",
|
|
1124
|
+
"documentation": { "value": "Defines a trait for horizontal code reuse.\n\n```php\ntrait HasTimestamps {\n public DateTime $createdAt;\n public DateTime $updatedAt;\n}\n```" },
|
|
1125
|
+
"insertText": "trait ${1:TraitName}\n{\n\t${2}\n}",
|
|
1126
|
+
"insertTextRules": 4,
|
|
1127
|
+
"sortText": "07_trait"
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
"label": "abstract class",
|
|
1131
|
+
"kind": 7,
|
|
1132
|
+
"detail": "Define an abstract class",
|
|
1133
|
+
"documentation": { "value": "Defines an abstract class that cannot be instantiated directly.\n\n```php\nabstract class Shape {\n abstract public function area(): float;\n\n public function describe(): string {\n return 'Area: ' . $this->area();\n }\n}\n```" },
|
|
1134
|
+
"insertText": "abstract class ${1:ClassName}\n{\n\tabstract public function ${2:method}(): ${3:void};\n\n\t${4}\n}",
|
|
1135
|
+
"insertTextRules": 4,
|
|
1136
|
+
"sortText": "07_abstract_class"
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
"label": "enum",
|
|
1140
|
+
"kind": 7,
|
|
1141
|
+
"detail": "Define an enumeration (PHP 8.1+)",
|
|
1142
|
+
"documentation": { "value": "Defines an enumeration, a restrictive type with a fixed set of possible values.\n\n```php\nenum Status: string {\n case Active = 'active';\n case Inactive = 'inactive';\n case Pending = 'pending';\n}\n```" },
|
|
1143
|
+
"insertText": "enum ${1:Name}: ${2:string}\n{\n\tcase ${3:Value} = '${4:value}';\n}",
|
|
1144
|
+
"insertTextRules": 4,
|
|
1145
|
+
"sortText": "07_enum"
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
"label": "public function",
|
|
1149
|
+
"kind": 1,
|
|
1150
|
+
"detail": "Define a public method",
|
|
1151
|
+
"documentation": { "value": "Defines a public method accessible from anywhere.\n\n```php\npublic function getName(): string\n{\n return $this->name;\n}\n```" },
|
|
1152
|
+
"insertText": "public function ${1:name}(${2}): ${3:void}\n{\n\t${4}\n}",
|
|
1153
|
+
"insertTextRules": 4,
|
|
1154
|
+
"sortText": "07_public_function"
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
"label": "private function",
|
|
1158
|
+
"kind": 1,
|
|
1159
|
+
"detail": "Define a private method",
|
|
1160
|
+
"documentation": { "value": "Defines a private method accessible only within the declaring class.\n\n```php\nprivate function validate(): bool\n{\n return $this->value > 0;\n}\n```" },
|
|
1161
|
+
"insertText": "private function ${1:name}(${2}): ${3:void}\n{\n\t${4}\n}",
|
|
1162
|
+
"insertTextRules": 4,
|
|
1163
|
+
"sortText": "07_private_function"
|
|
1164
|
+
},
|
|
1165
|
+
{
|
|
1166
|
+
"label": "protected function",
|
|
1167
|
+
"kind": 1,
|
|
1168
|
+
"detail": "Define a protected method",
|
|
1169
|
+
"documentation": { "value": "Defines a protected method accessible within the class and its subclasses.\n\n```php\nprotected function process(): void\n{\n // ...\n}\n```" },
|
|
1170
|
+
"insertText": "protected function ${1:name}(${2}): ${3:void}\n{\n\t${4}\n}",
|
|
1171
|
+
"insertTextRules": 4,
|
|
1172
|
+
"sortText": "07_protected_function"
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
"label": "__construct",
|
|
1176
|
+
"kind": 1,
|
|
1177
|
+
"detail": "Constructor method",
|
|
1178
|
+
"documentation": { "value": "Defines the constructor, called when an object is created.\n\n```php\npublic function __construct(\n private string $name,\n private int $age = 0,\n) {}\n```" },
|
|
1179
|
+
"insertText": "public function __construct(\n\t${1:private string \\$name},\n) {\n\t${2}\n}",
|
|
1180
|
+
"insertTextRules": 4,
|
|
1181
|
+
"sortText": "07___construct"
|
|
1182
|
+
},
|
|
1183
|
+
{
|
|
1184
|
+
"label": "__destruct",
|
|
1185
|
+
"kind": 1,
|
|
1186
|
+
"detail": "Destructor method",
|
|
1187
|
+
"documentation": { "value": "Called when there are no more references to an object or during shutdown.\n\n```php\npublic function __destruct()\n{\n fclose($this->handle);\n}\n```" },
|
|
1188
|
+
"insertText": "public function __destruct()\n{\n\t${1}\n}",
|
|
1189
|
+
"insertTextRules": 4,
|
|
1190
|
+
"sortText": "07___destruct"
|
|
1191
|
+
},
|
|
1192
|
+
{
|
|
1193
|
+
"label": "__toString",
|
|
1194
|
+
"kind": 1,
|
|
1195
|
+
"detail": "String representation method",
|
|
1196
|
+
"documentation": { "value": "Called when an object is converted to a string.\n\n```php\npublic function __toString(): string\n{\n return $this->name;\n}\n```" },
|
|
1197
|
+
"insertText": "public function __toString(): string\n{\n\treturn ${1:\\$this->name};\n}",
|
|
1198
|
+
"insertTextRules": 4,
|
|
1199
|
+
"sortText": "07___toString"
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
"label": "__get",
|
|
1203
|
+
"kind": 1,
|
|
1204
|
+
"detail": "Magic getter method",
|
|
1205
|
+
"documentation": { "value": "Called when reading inaccessible or non-existing properties.\n\n```php\npublic function __get(string $name): mixed\n{\n return $this->data[$name] ?? null;\n}\n```" },
|
|
1206
|
+
"insertText": "public function __get(string \\$name): mixed\n{\n\t${1:return \\$this->data[\\$name] ?? null;}\n}",
|
|
1207
|
+
"insertTextRules": 4,
|
|
1208
|
+
"sortText": "07___get"
|
|
1209
|
+
},
|
|
1210
|
+
{
|
|
1211
|
+
"label": "__set",
|
|
1212
|
+
"kind": 1,
|
|
1213
|
+
"detail": "Magic setter method",
|
|
1214
|
+
"documentation": { "value": "Called when writing to inaccessible or non-existing properties.\n\n```php\npublic function __set(string $name, mixed $value): void\n{\n $this->data[$name] = $value;\n}\n```" },
|
|
1215
|
+
"insertText": "public function __set(string \\$name, mixed \\$value): void\n{\n\t${1:\\$this->data[\\$name] = \\$value;}\n}",
|
|
1216
|
+
"insertTextRules": 4,
|
|
1217
|
+
"sortText": "07___set"
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
"label": "__call",
|
|
1221
|
+
"kind": 1,
|
|
1222
|
+
"detail": "Magic method call",
|
|
1223
|
+
"documentation": { "value": "Called when invoking inaccessible methods in an object context.\n\n```php\npublic function __call(string $name, array $arguments): mixed\n{\n // ...\n}\n```" },
|
|
1224
|
+
"insertText": "public function __call(string \\$name, array \\$arguments): mixed\n{\n\t${1}\n}",
|
|
1225
|
+
"insertTextRules": 4,
|
|
1226
|
+
"sortText": "07___call"
|
|
1227
|
+
},
|
|
1228
|
+
{
|
|
1229
|
+
"label": "__callStatic",
|
|
1230
|
+
"kind": 1,
|
|
1231
|
+
"detail": "Magic static method call",
|
|
1232
|
+
"documentation": { "value": "Called when invoking inaccessible methods in a static context.\n\n```php\npublic static function __callStatic(string $name, array $arguments): mixed\n{\n // ...\n}\n```" },
|
|
1233
|
+
"insertText": "public static function __callStatic(string \\$name, array \\$arguments): mixed\n{\n\t${1}\n}",
|
|
1234
|
+
"insertTextRules": 4,
|
|
1235
|
+
"sortText": "07___callStatic"
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
"label": "__invoke",
|
|
1239
|
+
"kind": 1,
|
|
1240
|
+
"detail": "Called when object used as function",
|
|
1241
|
+
"documentation": { "value": "Called when a script tries to call an object as a function.\n\n```php\npublic function __invoke(mixed ...$args): mixed\n{\n return $this->handle(...$args);\n}\n```" },
|
|
1242
|
+
"insertText": "public function __invoke(${1}): ${2:mixed}\n{\n\t${3}\n}",
|
|
1243
|
+
"insertTextRules": 4,
|
|
1244
|
+
"sortText": "07___invoke"
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
"label": "readonly",
|
|
1248
|
+
"kind": 14,
|
|
1249
|
+
"detail": "Readonly property modifier (PHP 8.1+)",
|
|
1250
|
+
"documentation": { "value": "Declares a property that can only be initialized once.\n\n```php\nclass User {\n public function __construct(\n public readonly string $name,\n public readonly int $id,\n ) {}\n}\n```" },
|
|
1251
|
+
"insertText": "readonly ${1:string} ${2:\\$property}",
|
|
1252
|
+
"insertTextRules": 4,
|
|
1253
|
+
"sortText": "07_readonly"
|
|
1254
|
+
},
|
|
1255
|
+
{
|
|
1256
|
+
"label": "match",
|
|
1257
|
+
"kind": 14,
|
|
1258
|
+
"detail": "Match expression (PHP 8.0+)",
|
|
1259
|
+
"documentation": { "value": "Evaluates a subject and returns a value based on an identity check.\n\n```php\n$result = match($status) {\n 'active' => 'Active',\n 'inactive', 'disabled' => 'Inactive',\n default => 'Unknown',\n};\n```" },
|
|
1260
|
+
"insertText": "match(${1:\\$value}) {\n\t${2:'case'} => ${3:'result'},\n\tdefault => ${4:'default'},\n}",
|
|
1261
|
+
"insertTextRules": 4,
|
|
1262
|
+
"sortText": "07_match"
|
|
1263
|
+
},
|
|
1264
|
+
{
|
|
1265
|
+
"label": "date",
|
|
1266
|
+
"kind": 1,
|
|
1267
|
+
"detail": "Format a local date/time",
|
|
1268
|
+
"documentation": { "value": "Returns a string formatted according to the given format string.\n\n```php\necho date('Y-m-d'); // '2024-01-15'\necho date('H:i:s'); // '14:30:00'\necho date('D, d M Y', $timestamp);\n```" },
|
|
1269
|
+
"insertText": "date('${1:Y-m-d H:i:s}')",
|
|
1270
|
+
"insertTextRules": 4,
|
|
1271
|
+
"sortText": "08_date"
|
|
1272
|
+
},
|
|
1273
|
+
{
|
|
1274
|
+
"label": "time",
|
|
1275
|
+
"kind": 1,
|
|
1276
|
+
"detail": "Return current Unix timestamp",
|
|
1277
|
+
"documentation": { "value": "Returns the current time measured in seconds since the Unix Epoch.\n\n```php\n$now = time();\n$future = time() + 3600; // 1 hour from now\n```" },
|
|
1278
|
+
"insertText": "time()",
|
|
1279
|
+
"insertTextRules": 4,
|
|
1280
|
+
"sortText": "08_time"
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
"label": "strtotime",
|
|
1284
|
+
"kind": 1,
|
|
1285
|
+
"detail": "Parse date/time string to timestamp",
|
|
1286
|
+
"documentation": { "value": "Parses an English textual date/time description into a Unix timestamp.\n\n```php\n$ts = strtotime('next Monday');\n$ts = strtotime('+1 week');\n$ts = strtotime('2024-12-31');\n```" },
|
|
1287
|
+
"insertText": "strtotime('${1:+1 day}')",
|
|
1288
|
+
"insertTextRules": 4,
|
|
1289
|
+
"sortText": "08_strtotime"
|
|
1290
|
+
},
|
|
1291
|
+
{
|
|
1292
|
+
"label": "mktime",
|
|
1293
|
+
"kind": 1,
|
|
1294
|
+
"detail": "Get Unix timestamp for a date",
|
|
1295
|
+
"documentation": { "value": "Returns the Unix timestamp corresponding to the arguments given.\n\n```php\n$ts = mktime(12, 0, 0, 6, 15, 2024);\n```" },
|
|
1296
|
+
"insertText": "mktime(${1:hour}, ${2:minute}, ${3:second}, ${4:month}, ${5:day}, ${6:year})",
|
|
1297
|
+
"insertTextRules": 4,
|
|
1298
|
+
"sortText": "08_mktime"
|
|
1299
|
+
},
|
|
1300
|
+
{
|
|
1301
|
+
"label": "new DateTime",
|
|
1302
|
+
"kind": 4,
|
|
1303
|
+
"detail": "Create a new DateTime object",
|
|
1304
|
+
"documentation": { "value": "Creates a new DateTime object representing the specified date and time.\n\n```php\n$now = new DateTime();\n$date = new DateTime('2024-01-15');\n$date = new DateTime('tomorrow');\n```" },
|
|
1305
|
+
"insertText": "new DateTime(${1:'now'})",
|
|
1306
|
+
"insertTextRules": 4,
|
|
1307
|
+
"sortText": "08_datetime"
|
|
1308
|
+
},
|
|
1309
|
+
{
|
|
1310
|
+
"label": "new DateTimeImmutable",
|
|
1311
|
+
"kind": 4,
|
|
1312
|
+
"detail": "Create an immutable DateTime object",
|
|
1313
|
+
"documentation": { "value": "Creates an immutable DateTime object. Modification methods return a new instance.\n\n```php\n$now = new DateTimeImmutable();\n$date = new DateTimeImmutable('2024-01-15 14:30:00');\n$tomorrow = $date->modify('+1 day');\n```" },
|
|
1314
|
+
"insertText": "new DateTimeImmutable(${1:'now'})",
|
|
1315
|
+
"insertTextRules": 4,
|
|
1316
|
+
"sortText": "08_datetime_immutable"
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
"label": "die",
|
|
1320
|
+
"kind": 14,
|
|
1321
|
+
"detail": "Output message and terminate",
|
|
1322
|
+
"documentation": { "value": "Outputs a message and terminates the current script. Equivalent to exit.\n\n```php\ndie('Fatal error occurred');\n$result or die('Failed');\n```" },
|
|
1323
|
+
"insertText": "die(${1:'message'});",
|
|
1324
|
+
"insertTextRules": 4,
|
|
1325
|
+
"sortText": "09_die"
|
|
1326
|
+
},
|
|
1327
|
+
{
|
|
1328
|
+
"label": "exit",
|
|
1329
|
+
"kind": 14,
|
|
1330
|
+
"detail": "Output message and terminate",
|
|
1331
|
+
"documentation": { "value": "Outputs a message and terminates the current script.\n\n```php\nexit(0); // success\nexit('Error message');\n```" },
|
|
1332
|
+
"insertText": "exit(${1:0});",
|
|
1333
|
+
"insertTextRules": 4,
|
|
1334
|
+
"sortText": "09_exit"
|
|
1335
|
+
},
|
|
1336
|
+
{
|
|
1337
|
+
"label": "sleep",
|
|
1338
|
+
"kind": 1,
|
|
1339
|
+
"detail": "Delay execution in seconds",
|
|
1340
|
+
"documentation": { "value": "Delays the program execution for the given number of seconds.\n\n```php\nsleep(2); // pause for 2 seconds\n```" },
|
|
1341
|
+
"insertText": "sleep(${1:seconds})",
|
|
1342
|
+
"insertTextRules": 4,
|
|
1343
|
+
"sortText": "09_sleep"
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
"label": "usleep",
|
|
1347
|
+
"kind": 1,
|
|
1348
|
+
"detail": "Delay execution in microseconds",
|
|
1349
|
+
"documentation": { "value": "Delays the program execution for the given number of microseconds.\n\n```php\nusleep(500000); // 0.5 seconds\n```" },
|
|
1350
|
+
"insertText": "usleep(${1:microseconds})",
|
|
1351
|
+
"insertTextRules": 4,
|
|
1352
|
+
"sortText": "09_usleep"
|
|
1353
|
+
},
|
|
1354
|
+
{
|
|
1355
|
+
"label": "class_exists",
|
|
1356
|
+
"kind": 1,
|
|
1357
|
+
"detail": "Check if class has been defined",
|
|
1358
|
+
"documentation": { "value": "Checks if the class has been defined.\n\n```php\nif (class_exists('App\\\\Models\\\\User')) { ... }\n```" },
|
|
1359
|
+
"insertText": "class_exists(${1:'ClassName'})",
|
|
1360
|
+
"insertTextRules": 4,
|
|
1361
|
+
"sortText": "09_class_exists"
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
"label": "function_exists",
|
|
1365
|
+
"kind": 1,
|
|
1366
|
+
"detail": "Check if function has been defined",
|
|
1367
|
+
"documentation": { "value": "Checks if the given function has been defined.\n\n```php\nif (function_exists('curl_init')) { ... }\n```" },
|
|
1368
|
+
"insertText": "function_exists(${1:'functionName'})",
|
|
1369
|
+
"insertTextRules": 4,
|
|
1370
|
+
"sortText": "09_function_exists"
|
|
1371
|
+
},
|
|
1372
|
+
{
|
|
1373
|
+
"label": "method_exists",
|
|
1374
|
+
"kind": 1,
|
|
1375
|
+
"detail": "Check if class method exists",
|
|
1376
|
+
"documentation": { "value": "Checks if the class method exists in the given object or class.\n\n```php\nif (method_exists($obj, 'render')) { ... }\n```" },
|
|
1377
|
+
"insertText": "method_exists(${1:\\$object}, ${2:'methodName'})",
|
|
1378
|
+
"insertTextRules": 4,
|
|
1379
|
+
"sortText": "09_method_exists"
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
"label": "property_exists",
|
|
1383
|
+
"kind": 1,
|
|
1384
|
+
"detail": "Check if property exists in object or class",
|
|
1385
|
+
"documentation": { "value": "Checks if the object or class has a property.\n\n```php\nif (property_exists($obj, 'name')) { ... }\n```" },
|
|
1386
|
+
"insertText": "property_exists(${1:\\$object}, ${2:'propertyName'})",
|
|
1387
|
+
"insertTextRules": 4,
|
|
1388
|
+
"sortText": "09_property_exists"
|
|
1389
|
+
},
|
|
1390
|
+
{
|
|
1391
|
+
"label": "header",
|
|
1392
|
+
"kind": 1,
|
|
1393
|
+
"detail": "Send a raw HTTP header",
|
|
1394
|
+
"documentation": { "value": "Send a raw HTTP header. Must be called before any output.\n\n```php\nheader('Content-Type: application/json');\nheader('Location: /dashboard');\nheader('HTTP/1.1 404 Not Found');\n```" },
|
|
1395
|
+
"insertText": "header('${1:Content-Type: application/json}');",
|
|
1396
|
+
"insertTextRules": 4,
|
|
1397
|
+
"sortText": "09_header"
|
|
1398
|
+
},
|
|
1399
|
+
{
|
|
1400
|
+
"label": "setcookie",
|
|
1401
|
+
"kind": 1,
|
|
1402
|
+
"detail": "Send a cookie",
|
|
1403
|
+
"documentation": { "value": "Sends a cookie. Must be called before any output.\n\n```php\nsetcookie('name', 'value', time() + 3600);\nsetcookie('user', $name, [\n 'expires' => time() + 86400,\n 'path' => '/',\n 'secure' => true,\n 'httponly' => true,\n]);\n```" },
|
|
1404
|
+
"insertText": "setcookie('${1:name}', ${2:\\$value}, ${3:time() + 3600})",
|
|
1405
|
+
"insertTextRules": 4,
|
|
1406
|
+
"sortText": "09_setcookie"
|
|
1407
|
+
},
|
|
1408
|
+
{
|
|
1409
|
+
"label": "sizeof",
|
|
1410
|
+
"kind": 1,
|
|
1411
|
+
"detail": "Alias of count()",
|
|
1412
|
+
"documentation": { "value": "Alias of count(). Counts all elements in an array.\n\n```php\n$total = sizeof($arr);\n```" },
|
|
1413
|
+
"insertText": "sizeof(${1:\\$array})",
|
|
1414
|
+
"insertTextRules": 4,
|
|
1415
|
+
"sortText": "02_sizeof"
|
|
1416
|
+
},
|
|
1417
|
+
{
|
|
1418
|
+
"label": "copy",
|
|
1419
|
+
"kind": 1,
|
|
1420
|
+
"detail": "Copy a file",
|
|
1421
|
+
"documentation": { "value": "Copies a file.\n\n```php\ncopy('source.txt', 'dest.txt');\nif (copy($src, $dst)) { echo 'Copied'; }\n```" },
|
|
1422
|
+
"insertText": "copy(${1:'source'}, ${2:'dest'})",
|
|
1423
|
+
"insertTextRules": 4,
|
|
1424
|
+
"sortText": "03_copy"
|
|
1425
|
+
},
|
|
1426
|
+
{
|
|
1427
|
+
"label": "rename",
|
|
1428
|
+
"kind": 1,
|
|
1429
|
+
"detail": "Rename a file or directory",
|
|
1430
|
+
"documentation": { "value": "Renames a file or directory.\n\n```php\nrename('old.txt', 'new.txt');\nrename($oldPath, $newPath);\n```" },
|
|
1431
|
+
"insertText": "rename(${1:'oldname'}, ${2:'newname'})",
|
|
1432
|
+
"insertTextRules": 4,
|
|
1433
|
+
"sortText": "03_rename"
|
|
1434
|
+
},
|
|
1435
|
+
{
|
|
1436
|
+
"label": "rmdir",
|
|
1437
|
+
"kind": 1,
|
|
1438
|
+
"detail": "Remove a directory",
|
|
1439
|
+
"documentation": { "value": "Removes a directory. The directory must be empty.\n\n```php\nrmdir('empty_dir');\n```" },
|
|
1440
|
+
"insertText": "rmdir(${1:'directory'})",
|
|
1441
|
+
"insertTextRules": 4,
|
|
1442
|
+
"sortText": "03_rmdir"
|
|
1443
|
+
},
|
|
1444
|
+
{
|
|
1445
|
+
"label": "mt_rand",
|
|
1446
|
+
"kind": 1,
|
|
1447
|
+
"detail": "Generate a random value via Mersenne Twister",
|
|
1448
|
+
"documentation": { "value": "Generates a random value via the Mersenne Twister Random Number Generator.\n\n```php\n$num = mt_rand(1, 100);\n```" },
|
|
1449
|
+
"insertText": "mt_rand(${1:min}, ${2:max})",
|
|
1450
|
+
"insertTextRules": 4,
|
|
1451
|
+
"sortText": "05_mt_rand"
|
|
1452
|
+
},
|
|
1453
|
+
{
|
|
1454
|
+
"label": "random_bytes",
|
|
1455
|
+
"kind": 1,
|
|
1456
|
+
"detail": "Generate cryptographically secure random bytes",
|
|
1457
|
+
"documentation": { "value": "Generates cryptographically secure pseudo-random bytes.\n\n```php\n$bytes = random_bytes(32);\n$hex = bin2hex(random_bytes(16));\n```" },
|
|
1458
|
+
"insertText": "random_bytes(${1:length})",
|
|
1459
|
+
"insertTextRules": 4,
|
|
1460
|
+
"sortText": "05_random_bytes"
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
"label": "settype",
|
|
1464
|
+
"kind": 1,
|
|
1465
|
+
"detail": "Set the type of a variable",
|
|
1466
|
+
"documentation": { "value": "Sets the type of a variable.\n\n```php\nsettype($var, 'integer');\nsettype($val, 'string');\n```" },
|
|
1467
|
+
"insertText": "settype(${1:\\$var}, '${2:integer}')",
|
|
1468
|
+
"insertTextRules": 4,
|
|
1469
|
+
"sortText": "06_settype"
|
|
1470
|
+
},
|
|
1471
|
+
{
|
|
1472
|
+
"label": "new",
|
|
1473
|
+
"kind": 14,
|
|
1474
|
+
"detail": "Create a new instance of a class",
|
|
1475
|
+
"documentation": { "value": "Creates a new instance of a class.\n\n```php\n$obj = new ClassName();\n$user = new User('John', 30);\n$date = new DateTime();\n```" },
|
|
1476
|
+
"insertText": "new ${1:ClassName}(${2})",
|
|
1477
|
+
"insertTextRules": 4,
|
|
1478
|
+
"sortText": "07_new"
|
|
1479
|
+
},
|
|
1480
|
+
{
|
|
1481
|
+
"label": "extends",
|
|
1482
|
+
"kind": 14,
|
|
1483
|
+
"detail": "Inherit from a class",
|
|
1484
|
+
"documentation": { "value": "A class can inherit methods and properties from another class using extends.\n\n```php\nclass Admin extends User {\n // ...\n}\n```" },
|
|
1485
|
+
"insertText": "extends ${1:ParentClass}",
|
|
1486
|
+
"insertTextRules": 4,
|
|
1487
|
+
"sortText": "07_extends"
|
|
1488
|
+
},
|
|
1489
|
+
{
|
|
1490
|
+
"label": "implements",
|
|
1491
|
+
"kind": 14,
|
|
1492
|
+
"detail": "Implement an interface",
|
|
1493
|
+
"documentation": { "value": "A class can implement one or more interfaces.\n\n```php\nclass Logger implements LoggerInterface {\n // ...\n}\n```" },
|
|
1494
|
+
"insertText": "implements ${1:InterfaceName}",
|
|
1495
|
+
"insertTextRules": 4,
|
|
1496
|
+
"sortText": "07_implements"
|
|
1497
|
+
},
|
|
1498
|
+
{
|
|
1499
|
+
"label": "static",
|
|
1500
|
+
"kind": 14,
|
|
1501
|
+
"detail": "Static keyword",
|
|
1502
|
+
"documentation": { "value": "Declares class members (properties or methods) as accessible without needing an instantiation.\n\n```php\nclass Counter {\n public static int $count = 0;\n\n public static function increment(): void {\n self::$count++;\n }\n}\n```" },
|
|
1503
|
+
"insertText": "static ${1}",
|
|
1504
|
+
"insertTextRules": 4,
|
|
1505
|
+
"sortText": "07_static"
|
|
1506
|
+
},
|
|
1507
|
+
{
|
|
1508
|
+
"label": "date_create",
|
|
1509
|
+
"kind": 1,
|
|
1510
|
+
"detail": "Create a new DateTime object (procedural)",
|
|
1511
|
+
"documentation": { "value": "Creates a new DateTime object. Procedural alias of DateTime::__construct.\n\n```php\n$date = date_create('2024-01-15');\n$now = date_create();\n```" },
|
|
1512
|
+
"insertText": "date_create('${1:now}')",
|
|
1513
|
+
"insertTextRules": 4,
|
|
1514
|
+
"sortText": "08_date_create"
|
|
1515
|
+
},
|
|
1516
|
+
{
|
|
1517
|
+
"label": "date_format",
|
|
1518
|
+
"kind": 1,
|
|
1519
|
+
"detail": "Format a DateTime object",
|
|
1520
|
+
"documentation": { "value": "Alias of DateTime::format. Returns a formatted date string.\n\n```php\n$formatted = date_format($date, 'Y-m-d H:i:s');\n```" },
|
|
1521
|
+
"insertText": "date_format(${1:\\$date}, '${2:Y-m-d}')",
|
|
1522
|
+
"insertTextRules": 4,
|
|
1523
|
+
"sortText": "08_date_format"
|
|
1524
|
+
},
|
|
1525
|
+
{
|
|
1526
|
+
"label": "date_diff",
|
|
1527
|
+
"kind": 1,
|
|
1528
|
+
"detail": "Return the difference between two dates",
|
|
1529
|
+
"documentation": { "value": "Returns a DateInterval representing the difference between two DateTime objects.\n\n```php\n$diff = date_diff($date1, $date2);\necho $diff->days . ' days';\n```" },
|
|
1530
|
+
"insertText": "date_diff(${1:\\$date1}, ${2:\\$date2})",
|
|
1531
|
+
"insertTextRules": 4,
|
|
1532
|
+
"sortText": "08_date_diff"
|
|
1533
|
+
}
|
|
1534
|
+
]
|
|
1535
|
+
}
|