File tree Expand file tree Collapse file tree 8 files changed +108
-0
lines changed
Expand file tree Collapse file tree 8 files changed +108
-0
lines changed Original file line number Diff line number Diff line change 1+ .idea /
2+ .vscode /
3+ /vendor /
4+ composer.lock
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Application ;
4+
5+ use DevNet \System \IO \Console ;
6+
7+ class Program
8+ {
9+ public static function main (array $ args = [])
10+ {
11+ Console::writeline ("Hello World! " );
12+ }
13+ }
Original file line number Diff line number Diff line change 1+ # DevNet Console Template
2+ This package is a Console application template of DevNet Framewark.
3+
4+ ## Requirements
5+ - PHP 7.4 or higher version from [ php.net] ( https://www.php.net/ )
6+ - Composer the dependency manager from [ getcomposer.org] ( https://getcomposer.org/ )
7+
8+ ## Installation
9+ To create a DevNet Console Application project using composer, run the following command in your terminal:
10+ ```
11+ composer create-project devnet/console-template [project-name]
12+ ```
13+ Or using DevNet CLI
14+ ```
15+ devnet new console --project [project-name]
16+ ```
17+
18+ ## Execution
19+ To run the application, navigate to the root of your project and run the following command in the Terminal:
20+ ```
21+ ./bin/run
22+ ```
23+ Or using DevNet CLI
24+ ```
25+ devnet run
26+ ```
27+
28+ ## Documentation
29+ Full documentation on how to use ** DevNet Framework** is available at [ devnet-framework.github.io] ( https://devnet-framework.github.io )
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use DevNet\System\Runtime\Launcher;
4+
5+ $projectFile = simplexml_load_file(__DIR__ . "/../project.phproj");
6+ $namespace = $projectFile->properties->namespace;
7+ $entrypoint = $projectFile->properties->entrypoint;
8+ $packages = $projectFile->dependencies->package ?? [];
9+
10+ if (PHP_OS_FAMILY == 'Windows') {
11+ $path = getenv('path');
12+ $paths = explode(';', $path);
13+ } else {
14+ $path = getenv('PATH');
15+ $paths = explode(':', $path);
16+ }
17+
18+ foreach ($paths as $path) {
19+ if (file_exists($path . '/../autoload.php')) {
20+ require $path . '/../autoload.php';
21+ break;
22+ }
23+ }
24+
25+ foreach ($packages as $package) {
26+ $include = (string)$package->attributes()->include;
27+ if (file_exists(__DIR__ . '/../' . $include)) {
28+ require __DIR__ . '/../' . $include;
29+ }
30+ }
31+
32+ $launcher = Launcher::getLauncher();
33+ $launcher->workspace(dirname(__DIR__));
34+ $launcher->namespace((string)$namespace);
35+ $launcher->entryPoint((string)$entrypoint);
36+ $launcher->launch();
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env php
2+ <?php
3+
4+ require 'apphost ' ;
Original file line number Diff line number Diff line change 1+ @ ECHO OFF
2+ setlocal DISABLEDELAYEDEXPANSION
3+ SET BIN_TARGET = %~dpn0
4+ php " %BIN_TARGET% " %*
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " devnet/console-project" ,
3+ "description" : " Console Application" ,
4+ "type" : " project" ,
5+ "license" : " MIT" ,
6+ "minimum-stability" : " dev" ,
7+ "prefer-stable" : true
8+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <project >
3+ <properties >
4+ <namespace >Application</namespace >
5+ <entrypoint >Program</entrypoint >
6+ </properties >
7+ <dependencies >
8+ <package include =" /vendor/autoload.php" />
9+ </dependencies >
10+ </project >
You can’t perform that action at this time.
0 commit comments