Chemaclass
Repos
66
Followers
97
Following
35

Phel is a functional programming language that compiles to PHP. It is a dialect of Lisp inspired by Clojure and Janet.

280
11

Gacela helps you separate your project into modules, focusing on the application/infrastructure layer, totally decoupled from your domain.

45
6

Basic setup to start coding phel

8
2

An implementation of the snake game using the CLI terminal written in phel.

0
1

Events

Update 7 behaviours that encourage trust

Created at 21 hours ago
pull request opened
Allow using Interface suffix for DocBlockResolver

📚 Description

Allow using an interface of your Facade (or any Service) specified as DocBlock resolvable, for example:

/**
 * @method FakeServiceInterface getService()
 */
final class DummyDocBlockResolverAware
{
    use DocBlockResolverAwareTrait;
}

🔖 Changes

  • On getClassFromDoc() add a last condition checking if the class name has Interface on it, and try finding a class name without the interface suffix.

Things to consider

This feature assumes that:

  • ...your interface will be on the same namespace as the concrete implementation
  • ...the concrete implementation has the same name as the interface

I would personally use the concrete class name in the DocBlock resolvable, but it might be useful for other scenarios.

Created at 1 day ago
create branch
Chemaclass create branch feature/allow-using-interface-suffix-in-docblock-resolver
Created at 1 day ago

Add custom funding link

Created at 1 day ago

Add custom funding link

Created at 1 day ago

Add custom funding link

Created at 1 day ago

Update bootstrap docs adding profiler feature

Update content/docs/bootstrap.md

Co-authored-by: Jesus Valera Reales jesus1902@outlook.com

Merge pull request #32 from gacela-project/feature/update-gacela-0-26

Update bootstrap docs adding profiler feature

Created at 1 day ago
Chemaclass delete branch feature/update-gacela-0-26
Created at 1 day ago
pull request closed
Update bootstrap docs adding profiler feature

📚 Changes

  • Normalize bootstrap php snippets
  • Remove removed "Cache Directory" and "Project Cache" sections
  • Add "Gacela Profiler" feature
Created at 1 day ago

Update content/docs/bootstrap.md

Co-authored-by: Jesus Valera Reales jesus1902@outlook.com

Created at 1 day ago
pull request opened
Update bootstrap docs adding profiler feature

📚 Changes

  • Normalize bootstrap php snippets
  • Remove removed "Cache Directory" and "Project Cache" sections
  • Add "Gacela Profiler" feature
Created at 1 day ago
Chemaclass create branch feature/update-gacela-0-26
Created at 1 day ago

Use strrpos instead of strpos when ClassInfo->normalizeFilename()

Add Revs and Iterations to NormalModuleBench

Created at 2 days ago
opened issue
Windows unsupported ClassInfo logic

📚 Context

I am developing in my MacOS PHP version, and I wanted to ensure that Gacela works fine in Windows PHP versions as well. So, I added them to the CI and to my surprise, we got an opportunity to improve Gacela and making it fully compatible with Windows.

This is the PR: https://github.com/gacela-project/gacela/pull/201 you can see the failing tests there:

Created at 2 days ago
pull request opened
Beautify output from LayerPlanCreatorCommand

🗒️ Changes

  • Use $output->writeln() instead of print
  • Beautify the rendered output json with JSON_PRETTY_PRINT

🖼️ Screenshots

BEFORE

AFTER

Created at 2 days ago

renaming layer to tile

Merge pull request #4 from sebastianlarisch/feature/rename-layer-to-tile

renaming layer to tile

new class TilePlanner with named constructor which can be used to create plan in projects

Update build.yml

add ubuntu-latest as runs-on to github workflow

fix php-stan

Merge pull request #5 from sebastianlarisch/feature/new-creator-class-to-use-planner-in-projects

new class TilePlanner

use dto instead of array as input for new plan creation

Merge pull request #6 from sebastianlarisch/feature/use-dto-as-input-object

use dto instead of array as input for new plan creation

Update README.md

Update README.md

Beautify output from LayerPlanCreatorCommand

Created at 2 days ago
create branch
Chemaclass create branch feature/beautify-output-from-create-layer-command
Created at 2 days ago

Update gacela@0.26

Created at 2 days ago
pull request opened
Add argv argument to Phel::run()

🤔 Background

We have a function Phel::run() to run a concrete namespace from phel. However, there might be some need to have some concrete argv in that particular namespace. Right now, the only way is to setup manually from the outside like

$GLOBALS['argv'][] = 'additional arguments';

💡 Goal

To be able to add your additional phel arguments when running a concrete namespace with Phel::run() as an optional argument to that function.

🔖 Changes

  • Add a new argument to the Phel::run() funtion ➡️ array|string $argv

🧪 Tests (TODO)

I did some manual tests and it works as expected. However, I think it would be nice to have automated tests for this as well.

Created at 2 days ago

Allow array type for argv in Phel::run()

Created at 2 days ago
opened issue
Allow ignore phel files at compile time

📖 Context

I usually have some code that render something or throw some exception in my src/phel/local.phel. And this is fine, because it's also gitignored. It's usually a nice file to do quick tests in your local env.

The issue comes when running the tests, the CompileCommandTest crashes because it runs also local.phel and throwing an exception is something that breaks the test.

💡 Suggestion

Add a new key-value to phel-config.php to be able to ignore certain files at compile time (by name or pattern path, for example).

# phel-config.php
return [
    // other config key-values...
    'ignore' => ['local.phel'], // this can be the default value, but the user can define any value/s they want
];

Created at 2 days ago
closed issue
Phel compile triggers I/O

| Q | A | |---------------------|-----------------| | Phel version | master | | PHP version | PHP 8.1.6 (cli) |

Summary

Phel compile executes the full code, especially the I/O from the snake-game.

Current behavior

The game starts on the terminal.

How to reproduce

git clone https://github.com/Chemaclass/phel-snake
cd phel-snake
composer install
vendor/bin/phel compile

https://user-images.githubusercontent.com/5256287/176547578-d6cb43ef-c1ae-4802-844a-f2e4bdfbf56a.mov

Note: As you can see in the video, there is actually another bug: Source: https://github.com/Chemaclass/phel-cli-gui/blob/master/src/phel/test-keyboard.phel But I would rather focus in this issue on the compile command I/O problem, and work on the Cannot resolve symbol 'read-input' in another issue/PR.

Cannot resolve symbol 'read-input'
in /Users/jose.valera/Code/chemaclass/phel-snake/vendor/chemaclass/phel-cli-gui/src/phel/test-keyboard.phel:14

8| (defn main
9|   "Display the key and its hexadecimal value on the fly"
10|   []
11|   (println "Type something...")
12|   (loop []
13|     (php/usleep 1000)
14|     (let [input (read-input 3)]
                     ^^^^^^^^^^
15|       (render-input input)
16|       (recur))))

Expected behavior

The compiled files would have been generated without any interruptions; aka the game starting.

Created at 2 days ago
issue comment
Phel compile triggers I/O

I solved this by adding a check in the main script (similar as done in python): https://github.com/Chemaclass/phel-snake/blob/master/src/game.phel#L113

(if (true? (contains-value? argv "play"))
    (main))

And then adding that argv only when running the game: vendor/bin/phel run src/game.phel play Or the compiled version: https://github.com/Chemaclass/phel-snake/blob/master/play.php#L11

$GLOBALS['argv'][] = 'play';
require_once $compiledFile;

Kudos to @mabasic that gave me the idea here: https://gitter.im/phel-lang/community?at=62e62c5c72ad51741fa6f2a0

Created at 2 days ago
create branch
Chemaclass create branch feature/add-argv-via-run
Created at 2 days ago