From f8f765511f886f9b110caf0bd37790a31f6b0018 Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Fri, 24 May 2024 11:39:37 +0200 Subject: [PATCH] simplify getting started --- content/documentation/getting-started.md | 55 +++++------------------- 1 file changed, 10 insertions(+), 45 deletions(-) diff --git a/content/documentation/getting-started.md b/content/documentation/getting-started.md index 4f573f6..29d8a5b 100644 --- a/content/documentation/getting-started.md +++ b/content/documentation/getting-started.md @@ -30,48 +30,13 @@ cd hello-world composer init ``` -Composer will ask a bunch of questions that can be answered as in the following example. - -``` -Welcome to the Composer config generator - -This command will guide you through creating your composer.json config. - -Package name (/): phel-lang/hello-world -Description []: -Author [Your Name , n to skip]: -Minimum Stability []: -Package Type (e.g. library, project, metapackage, composer-plugin) []: project -License []: - -Define your dependencies. - -Would you like to define your dependencies (require) interactively [yes]? no -Would you like to define your dev dependencies (require-dev) interactively [yes]? no - -{ - "name": "phel-lang/hello-world", - "type": "project", - "authors": [ - { - "name": "Your Name", - "email": "your.name@domain.com" - } - ], - "require": {} -} - -Do you confirm generation [yes]? yes -``` - Next, require Phel as a dependency. ```bash -# Require and install Phel composer require phel-lang/phel-lang ``` -First, create a phel config file, called `phel-config.php` in the root of the project: +Optionally, create the "phel config file", named `phel-config.php` in the root of the project: ```php Read the docs for [Configuration](/documentation/configuration) to see all available configuration options for Phel. -Then, create a new directory `src` with a file `boot.phel` inside this directory. +Then, create a new directory `src` with a file `main.phel` inside this directory. ```bash mkdir src ``` -The file `boot.phel` contains the actual code of the project. It defines the namespace and prints "Hello, World!". +The file `main.phel` contains the actual code of the project. It defines the namespace and prints "Hello, World!". ```phel -# in src/boot.phel -(ns hello-world\boot) +# inside `src/main.phel` +(ns hello-world\main) (println "Hello, World!") ``` @@ -109,11 +74,11 @@ There are two ways to run the code: from the command line and with a PHP Server. Code can be executed from the command line by calling the `vendor/bin/phel run` command, followed by the file path or namespace: ```bash -vendor/bin/phel run src/boot.phel +vendor/bin/phel run src/main.phel # or -vendor/bin/phel run hello-world\\boot +vendor/bin/phel run hello-world\\main # or -vendor/bin/phel run "hello-world\boot" +vendor/bin/phel run "hello-world\main" ``` The output will be: @@ -127,7 +92,7 @@ Hello, World! > Check the [web-skeleton project on GitHub](https://github.com/phel-lang/web-skeleton). -The file `index.php` will be executed by the PHP Server. It initializes the Phel Runtime and loads the namespace from the `boot.phel` file described above, to start the application. +The file `index.php` will be executed by the PHP Server. It initializes the Phel Runtime and loads the namespace from the `main.phel` file described above, to start the application. ```php // src/index.php @@ -139,7 +104,7 @@ $projectRootDir = __DIR__ . '/../'; require $projectRootDir . 'vendor/autoload.php'; -Phel::run($projectRootDir, 'hello-world\\boot'); +Phel::run($projectRootDir, 'hello-world\\main'); ``` The PHP Server can now be started.