Skip to content

Ziyadsk/DK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Another way to write your php

Installation

Via Composer

composer global require ziyadsk/dk:dev-master

Add the composer bin to your path

echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc

Usage

dk [file] [destination]

- If no destination is given the current directory will be the destination.

Features

DK transform more readable code into php

Removed semicolons and dollar signs and openning tags :

    name = "John Doe"
    echo("Hello")

to

<?php
    $name = "John Doe" ; 
    echo($name);
?>

Shorter syntax for functions and loops :

fn print_100_times(variable){
    for(i in {1..100}){
        print(variable)
    }
}

to

<?php
    function print_100_times($variable){
        for($i=0 ;$i<=100; $i++){
            print($variable);
        }
    }
?>

More readable foreach loops :

    for(element in my_arr){
        print(element)
    }
}

to

<?php
    foreach($my_arr as $element){
        print($element);
    }
?>

classes , class propreties and interfaces:

    class Car : Vehicule [SomeInterface,AnotherInterFace] {
        static pub name = "Honda"
        serial_number = "9819020Z0DJLOZEOLD"
        pub fn start_engine(){}
    }
    myCar = new Car()
    myCar->start_engine() 
    

to

<?php
    class Car extends Vehicule implements SomeInterface, AnotherInterFace {
        static $name = "Honda";
        private $serial_number = "9819020Z0DJLOZEOLD";
        public function start_engine() {}
    }
    $myCar = new Car() ; 
    $myCar->start_engine() ; 
?>

Editor Support

  • VScode extension -> DK

License

MIT

About

Another way to write your php

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages