A rawmode CLI editor, in PHP, based on the C Kilo tutorial: https://viewsourcecode.org/snaptoken/kilo/
Go to file
Timothy Warren 8bcc4c6807
All checks were successful
timw4mail/php-kilo/pipeline/head This commit looks good
Start experimenting with PHP7.4 transpiling via rector
2021-04-23 14:38:42 -04:00
src Refactor matches to be transpilable 2021-04-23 14:34:08 -04:00
tests Update test snapshots 2021-04-15 13:21:55 -04:00
.editorconfig Add editorconfig 2019-10-10 15:49:18 -04:00
.gitignore Fix CTRL method 2020-02-05 16:32:17 -05:00
composer.json Start experimenting with PHP7.4 transpiling via rector 2021-04-23 14:38:42 -04:00
composer.lock Start experimenting with PHP7.4 transpiling via rector 2021-04-23 14:38:42 -04:00
Dockerfile Try to fix CI with different docker image 2021-03-04 09:12:41 -05:00
Jenkinsfile Attempt to fix CI tests 2021-03-03 20:28:27 -05:00
kilo Fix more things that were broken 2021-03-17 15:38:52 -04:00
phpstan.neon More cleanup 2021-03-04 16:41:12 -05:00
phpunit.xml Fix more tests 2021-04-14 14:40:35 -04:00
README.md Refactor related class properties into their own objects 2021-03-11 16:56:02 -05:00
rector.php Start experimenting with PHP7.4 transpiling via rector 2021-04-23 14:38:42 -04:00
test.php Some refactoring 2021-03-09 17:22:49 -05:00

PHP Kilo

Build Status

A reimplementation of the Kilo tutorial in PHP. Also has some inspiration from the Hecto text editor tutorial. Requires PHP 8 and FFI.

Requirements

  • PHP 8
  • FFI enabled

Implementation notes:

  • The editor prefix has been removed from all the relevant functions, instead they are methods on one of the implementation classes.
  • Enums are faked with class constants
  • Composer is used for autoloading
  • Properties that must be manually updated in the C version (like counts/string length) are implemented with magic methods, so they are essentially calculated on read.
  • Generally, if a function exists in PHP, with the same name as the C function, the PHP version will be used.
  • Classes are used to modularize functionality, and reduce the amount of functions with global side effects