We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f947924 commit 4b24a8cCopy full SHA for 4b24a8c
1 file changed
examples/minimal.php
@@ -0,0 +1,28 @@
1
+#!/usr/bin/php
2
+<?php
3
+require __DIR__ . '/../vendor/autoload.php';
4
+use splitbrain\phpcli\CLI;
5
+use splitbrain\phpcli\Options;
6
+
7
+class Minimal extends CLI
8
+{
9
+ // register options and arguments
10
+ protected function setup(Options $options)
11
+ {
12
+ $options->setHelp('A very minimal example that does nothing but print a version');
13
+ $options->registerOption('version', 'print version', 'v');
14
+ }
15
16
+ // implement your code
17
+ protected function main(Options $options)
18
19
+ if ($options->getOpt('version')) {
20
+ $this->info('1.0.0');
21
+ } else {
22
+ echo $options->help();
23
24
25
+}
26
+// execute it
27
+$cli = new Minimal();
28
+$cli->run();
0 commit comments