FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
php-cli/examples/minimal.php at dynamicLogLevel · splitbrain/php-cli · GitHub
splitbrain
/
php-cli
Public
Notifications
You must be signed in to change notification settings
Fork
40
Star
179
Code
Issues
1
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
php-cli
/
examples
/
minimal.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
28 lines (26 loc) · 683 Bytes
Breadcrumbs
php-cli
/
examples
/
minimal.php
Copy path
File metadata and controls
executable file
·
28 lines (26 loc) · 683 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/php
<?php
require
__DIR__
.
'
/../vendor/autoload.php
'
;
use
splitbrain
\
phpcli
\
CLI
;
use
splitbrain
\
phpcli
\
Options
;
class
Minimal
extends
CLI
{
// register options and arguments
protected
function
setup
(
Options
$
options
)
{
$
options
->
setHelp
(
'
A very minimal example that does nothing but print a version
'
);
$
options
->
registerOption
(
'
version
'
,
'
print version
'
,
'
v
'
);
}
// implement your code
protected
function
main
(
Options
$
options
)
{
if
(
$
options
->
getOpt
(
'
version
'
)) {
$
this
->
info
(
'
1.0.0
'
);
}
else
{
echo
$
options
->
help
();
}
}
}
// execute it
$
cli
=
new
Minimal
();
$
cli
->
run
();
Back
|
FazBrowse Home
|
New Git URL