micro-framework for command applications to process data, either in php or python?2019 Community Moderator ElectionCalling an external command in PythonHow do I get the application exit code from a Windows command line?Executing command line programs from within pythonHow to read/process command line arguments?Xcode “Build and Archive” from command lineHow Do You Parse and Process HTML/XML in PHP?PHP framework for building e-commerce site?what i need to consider when building phar file from php application use php framework like laravelLumen Micro Framework => php artisan key:generatehow to remove <?php tag in command line and view laravel

ESPP--any reason not to go all in?

cannot log in to the server after changing SSH port

What would be the most expensive material to an intergalactic society?

How do spaceships determine each other's mass in space?

How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?

Cycles on the torus

What is the "determinant" of two vectors?

Is it appropriate to ask a former professor to order a book for me through an inter-library loan?

Having the player face themselves after the mid-game

Is it a Cyclops number? "Nobody" knows!

What does the Digital Threat scope actually do?

What can I do if someone tampers with my SSH public key?

Why do we say 'Pairwise Disjoint', rather than 'Disjoint'?

What should I do when a paper is published similar to my PhD thesis without citation?

Can the Witch Sight warlock invocation see through the Mirror Image spell?

Gomel chasadim tovim - are there bad chasadim?

Idiom for feeling after taking risk and someone else being rewarded

What does *dead* mean in *What do you mean, dead?*?

Movie: boy escapes the real world and goes to a fantasy world with big furry trolls

Was it really inappropriate to write a pull request for the company I interviewed with?

Why aren't there more Gauls like Obelix?

What will happen if my luggage gets delayed?

What sort of fish is this

How exactly does an Ethernet collision happen in the cable, since nodes use different circuits for Tx and Rx?



micro-framework for command applications to process data, either in php or python?



2019 Community Moderator ElectionCalling an external command in PythonHow do I get the application exit code from a Windows command line?Executing command line programs from within pythonHow to read/process command line arguments?Xcode “Build and Archive” from command lineHow Do You Parse and Process HTML/XML in PHP?PHP framework for building e-commerce site?what i need to consider when building phar file from php application use php framework like laravelLumen Micro Framework => php artisan key:generatehow to remove <?php tag in command line and view laravel










0















Here is what I use to build a php command line applications to process data.



These applications are not web applications, they run in command line shell to process some data.



Due to the Legacy reason, I use Laravel php framework.



So I use Laravel "Artisan Development" to build custom commands and then run the commands use



php artisan ...


Laravel is for a web app, but now, I am only using its artisan commands. It seems an overkill, that I install the full version Laravel Framework for this purpose.



But I could not find a good php micro-framework specially to building commands application.



My questions are



  • Like Lumen, a micro-framework by Laravel for API, do you have any laravel/php micro-framework for commands you can recommend?

  • Or are there any python micro-frameworks for command applications you can recommend? I googled, "Click" is recommended. Any frameworks else?

Thanks!










share|improve this question
























  • I have one I made if you want it, Github its about as small as it gets, it's like 1 file. Should be pretty easy to use.

    – ArtisticPhoenix
    Mar 7 at 0:13















0















Here is what I use to build a php command line applications to process data.



These applications are not web applications, they run in command line shell to process some data.



Due to the Legacy reason, I use Laravel php framework.



So I use Laravel "Artisan Development" to build custom commands and then run the commands use



php artisan ...


Laravel is for a web app, but now, I am only using its artisan commands. It seems an overkill, that I install the full version Laravel Framework for this purpose.



But I could not find a good php micro-framework specially to building commands application.



My questions are



  • Like Lumen, a micro-framework by Laravel for API, do you have any laravel/php micro-framework for commands you can recommend?

  • Or are there any python micro-frameworks for command applications you can recommend? I googled, "Click" is recommended. Any frameworks else?

Thanks!










share|improve this question
























  • I have one I made if you want it, Github its about as small as it gets, it's like 1 file. Should be pretty easy to use.

    – ArtisticPhoenix
    Mar 7 at 0:13













0












0








0








Here is what I use to build a php command line applications to process data.



These applications are not web applications, they run in command line shell to process some data.



Due to the Legacy reason, I use Laravel php framework.



So I use Laravel "Artisan Development" to build custom commands and then run the commands use



php artisan ...


Laravel is for a web app, but now, I am only using its artisan commands. It seems an overkill, that I install the full version Laravel Framework for this purpose.



But I could not find a good php micro-framework specially to building commands application.



My questions are



  • Like Lumen, a micro-framework by Laravel for API, do you have any laravel/php micro-framework for commands you can recommend?

  • Or are there any python micro-frameworks for command applications you can recommend? I googled, "Click" is recommended. Any frameworks else?

Thanks!










share|improve this question
















Here is what I use to build a php command line applications to process data.



These applications are not web applications, they run in command line shell to process some data.



Due to the Legacy reason, I use Laravel php framework.



So I use Laravel "Artisan Development" to build custom commands and then run the commands use



php artisan ...


Laravel is for a web app, but now, I am only using its artisan commands. It seems an overkill, that I install the full version Laravel Framework for this purpose.



But I could not find a good php micro-framework specially to building commands application.



My questions are



  • Like Lumen, a micro-framework by Laravel for API, do you have any laravel/php micro-framework for commands you can recommend?

  • Or are there any python micro-frameworks for command applications you can recommend? I googled, "Click" is recommended. Any frameworks else?

Thanks!







php python command-line command






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 6 at 23:26







searain

















asked Mar 6 at 22:56









searainsearain

8691017




8691017












  • I have one I made if you want it, Github its about as small as it gets, it's like 1 file. Should be pretty easy to use.

    – ArtisticPhoenix
    Mar 7 at 0:13

















  • I have one I made if you want it, Github its about as small as it gets, it's like 1 file. Should be pretty easy to use.

    – ArtisticPhoenix
    Mar 7 at 0:13
















I have one I made if you want it, Github its about as small as it gets, it's like 1 file. Should be pretty easy to use.

– ArtisticPhoenix
Mar 7 at 0:13





I have one I made if you want it, Github its about as small as it gets, it's like 1 file. Should be pretty easy to use.

– ArtisticPhoenix
Mar 7 at 0:13












2 Answers
2






active

oldest

votes


















1














For Python, I definitely recommend Click. It has become the Python library for creating command line tools. It's written/maintained by the author of Flask (currently the #5 most-starred Python repo on GitHub). I use Click all the time when creating command line tools. It has everything most people would need.



Not sure what your definition of a micro-framework is, but Click has no external dependencies and takes up approx. 500 KB (including .pyc files) when I install it. Also, it doesn't really require any boilerplate to setup and start using. So I guess I would call it a micro-framework.






share|improve this answer























  • github.com/google/python-fire How about Python Fire? If I am going to run the commands on GCP, would python-fire be a good selection too? due to it is Google supported?

    – searain
    Mar 7 at 0:53


















1














I made this small library,



https://github.com/ArtisticPhoenix/Cli



Your welcome to use it Or get inspiration from it, basically its a wrapper around getopt()



http://php.net/manual/en/function.getopt.php




getopt — Gets options from the command line argument list




You can get it on composer too:



"require" : 
"evo/cli" : "~1.0"



Basic usage is like this:



$Cli = Cli::getInstance();
$Cli->setArgument('h', 'help', 'Show this help document');
//... other arguments
if($Cli->getArgument('h')) $Cli->printHelpDoc(); //exits


And so on.



You can even do it from a PHP config file, which just gets put into setArgument() ~ basically.



//config.php
return [
[
'shortName' => 'h',
'longName' => 'help',
'doc' => 'Show this help document'
]
];


Then



 //cli.php

$config = require 'config.php';

$Cli = Cli::getInstance();
$Cli->fromConfig($config);

if($Cli->getArgument('h')) $Cli->printHelpDoc(); //exits


You can also do dynamic validation of the input args like this (with a closure):



 $Cli->setArgument('f', 'foo', 'This is just foo, and must always be foo', [
'accept' => function($shortName, $value)
if($value == 'foo') return true;
return false;

]);


The above just returns a Boolean, if the value is good or not. If you return false it will issue an exception, etc. You can also make an argument required like this:



 $Cli->setArgument('i', 'input', 'This is input that requires a value', [
'requireValue' => true
]);


And of course you can combine those 2.



There is some documentation on the Github page. It has a few small dependencies, just common stuff that I like to re-use (all in composer). Together it's less then 1000 lines of code. Maybe 20 or 30kb.



I needed to make a small command line thing, and I had this idea...






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55033522%2fmicro-framework-for-command-applications-to-process-data-either-in-php-or-pytho%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    For Python, I definitely recommend Click. It has become the Python library for creating command line tools. It's written/maintained by the author of Flask (currently the #5 most-starred Python repo on GitHub). I use Click all the time when creating command line tools. It has everything most people would need.



    Not sure what your definition of a micro-framework is, but Click has no external dependencies and takes up approx. 500 KB (including .pyc files) when I install it. Also, it doesn't really require any boilerplate to setup and start using. So I guess I would call it a micro-framework.






    share|improve this answer























    • github.com/google/python-fire How about Python Fire? If I am going to run the commands on GCP, would python-fire be a good selection too? due to it is Google supported?

      – searain
      Mar 7 at 0:53















    1














    For Python, I definitely recommend Click. It has become the Python library for creating command line tools. It's written/maintained by the author of Flask (currently the #5 most-starred Python repo on GitHub). I use Click all the time when creating command line tools. It has everything most people would need.



    Not sure what your definition of a micro-framework is, but Click has no external dependencies and takes up approx. 500 KB (including .pyc files) when I install it. Also, it doesn't really require any boilerplate to setup and start using. So I guess I would call it a micro-framework.






    share|improve this answer























    • github.com/google/python-fire How about Python Fire? If I am going to run the commands on GCP, would python-fire be a good selection too? due to it is Google supported?

      – searain
      Mar 7 at 0:53













    1












    1








    1







    For Python, I definitely recommend Click. It has become the Python library for creating command line tools. It's written/maintained by the author of Flask (currently the #5 most-starred Python repo on GitHub). I use Click all the time when creating command line tools. It has everything most people would need.



    Not sure what your definition of a micro-framework is, but Click has no external dependencies and takes up approx. 500 KB (including .pyc files) when I install it. Also, it doesn't really require any boilerplate to setup and start using. So I guess I would call it a micro-framework.






    share|improve this answer













    For Python, I definitely recommend Click. It has become the Python library for creating command line tools. It's written/maintained by the author of Flask (currently the #5 most-starred Python repo on GitHub). I use Click all the time when creating command line tools. It has everything most people would need.



    Not sure what your definition of a micro-framework is, but Click has no external dependencies and takes up approx. 500 KB (including .pyc files) when I install it. Also, it doesn't really require any boilerplate to setup and start using. So I guess I would call it a micro-framework.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 7 at 0:38









    jnrbsnjnrbsn

    1,64211219




    1,64211219












    • github.com/google/python-fire How about Python Fire? If I am going to run the commands on GCP, would python-fire be a good selection too? due to it is Google supported?

      – searain
      Mar 7 at 0:53

















    • github.com/google/python-fire How about Python Fire? If I am going to run the commands on GCP, would python-fire be a good selection too? due to it is Google supported?

      – searain
      Mar 7 at 0:53
















    github.com/google/python-fire How about Python Fire? If I am going to run the commands on GCP, would python-fire be a good selection too? due to it is Google supported?

    – searain
    Mar 7 at 0:53





    github.com/google/python-fire How about Python Fire? If I am going to run the commands on GCP, would python-fire be a good selection too? due to it is Google supported?

    – searain
    Mar 7 at 0:53













    1














    I made this small library,



    https://github.com/ArtisticPhoenix/Cli



    Your welcome to use it Or get inspiration from it, basically its a wrapper around getopt()



    http://php.net/manual/en/function.getopt.php




    getopt — Gets options from the command line argument list




    You can get it on composer too:



    "require" : 
    "evo/cli" : "~1.0"



    Basic usage is like this:



    $Cli = Cli::getInstance();
    $Cli->setArgument('h', 'help', 'Show this help document');
    //... other arguments
    if($Cli->getArgument('h')) $Cli->printHelpDoc(); //exits


    And so on.



    You can even do it from a PHP config file, which just gets put into setArgument() ~ basically.



    //config.php
    return [
    [
    'shortName' => 'h',
    'longName' => 'help',
    'doc' => 'Show this help document'
    ]
    ];


    Then



     //cli.php

    $config = require 'config.php';

    $Cli = Cli::getInstance();
    $Cli->fromConfig($config);

    if($Cli->getArgument('h')) $Cli->printHelpDoc(); //exits


    You can also do dynamic validation of the input args like this (with a closure):



     $Cli->setArgument('f', 'foo', 'This is just foo, and must always be foo', [
    'accept' => function($shortName, $value)
    if($value == 'foo') return true;
    return false;

    ]);


    The above just returns a Boolean, if the value is good or not. If you return false it will issue an exception, etc. You can also make an argument required like this:



     $Cli->setArgument('i', 'input', 'This is input that requires a value', [
    'requireValue' => true
    ]);


    And of course you can combine those 2.



    There is some documentation on the Github page. It has a few small dependencies, just common stuff that I like to re-use (all in composer). Together it's less then 1000 lines of code. Maybe 20 or 30kb.



    I needed to make a small command line thing, and I had this idea...






    share|improve this answer





























      1














      I made this small library,



      https://github.com/ArtisticPhoenix/Cli



      Your welcome to use it Or get inspiration from it, basically its a wrapper around getopt()



      http://php.net/manual/en/function.getopt.php




      getopt — Gets options from the command line argument list




      You can get it on composer too:



      "require" : 
      "evo/cli" : "~1.0"



      Basic usage is like this:



      $Cli = Cli::getInstance();
      $Cli->setArgument('h', 'help', 'Show this help document');
      //... other arguments
      if($Cli->getArgument('h')) $Cli->printHelpDoc(); //exits


      And so on.



      You can even do it from a PHP config file, which just gets put into setArgument() ~ basically.



      //config.php
      return [
      [
      'shortName' => 'h',
      'longName' => 'help',
      'doc' => 'Show this help document'
      ]
      ];


      Then



       //cli.php

      $config = require 'config.php';

      $Cli = Cli::getInstance();
      $Cli->fromConfig($config);

      if($Cli->getArgument('h')) $Cli->printHelpDoc(); //exits


      You can also do dynamic validation of the input args like this (with a closure):



       $Cli->setArgument('f', 'foo', 'This is just foo, and must always be foo', [
      'accept' => function($shortName, $value)
      if($value == 'foo') return true;
      return false;

      ]);


      The above just returns a Boolean, if the value is good or not. If you return false it will issue an exception, etc. You can also make an argument required like this:



       $Cli->setArgument('i', 'input', 'This is input that requires a value', [
      'requireValue' => true
      ]);


      And of course you can combine those 2.



      There is some documentation on the Github page. It has a few small dependencies, just common stuff that I like to re-use (all in composer). Together it's less then 1000 lines of code. Maybe 20 or 30kb.



      I needed to make a small command line thing, and I had this idea...






      share|improve this answer



























        1












        1








        1







        I made this small library,



        https://github.com/ArtisticPhoenix/Cli



        Your welcome to use it Or get inspiration from it, basically its a wrapper around getopt()



        http://php.net/manual/en/function.getopt.php




        getopt — Gets options from the command line argument list




        You can get it on composer too:



        "require" : 
        "evo/cli" : "~1.0"



        Basic usage is like this:



        $Cli = Cli::getInstance();
        $Cli->setArgument('h', 'help', 'Show this help document');
        //... other arguments
        if($Cli->getArgument('h')) $Cli->printHelpDoc(); //exits


        And so on.



        You can even do it from a PHP config file, which just gets put into setArgument() ~ basically.



        //config.php
        return [
        [
        'shortName' => 'h',
        'longName' => 'help',
        'doc' => 'Show this help document'
        ]
        ];


        Then



         //cli.php

        $config = require 'config.php';

        $Cli = Cli::getInstance();
        $Cli->fromConfig($config);

        if($Cli->getArgument('h')) $Cli->printHelpDoc(); //exits


        You can also do dynamic validation of the input args like this (with a closure):



         $Cli->setArgument('f', 'foo', 'This is just foo, and must always be foo', [
        'accept' => function($shortName, $value)
        if($value == 'foo') return true;
        return false;

        ]);


        The above just returns a Boolean, if the value is good or not. If you return false it will issue an exception, etc. You can also make an argument required like this:



         $Cli->setArgument('i', 'input', 'This is input that requires a value', [
        'requireValue' => true
        ]);


        And of course you can combine those 2.



        There is some documentation on the Github page. It has a few small dependencies, just common stuff that I like to re-use (all in composer). Together it's less then 1000 lines of code. Maybe 20 or 30kb.



        I needed to make a small command line thing, and I had this idea...






        share|improve this answer















        I made this small library,



        https://github.com/ArtisticPhoenix/Cli



        Your welcome to use it Or get inspiration from it, basically its a wrapper around getopt()



        http://php.net/manual/en/function.getopt.php




        getopt — Gets options from the command line argument list




        You can get it on composer too:



        "require" : 
        "evo/cli" : "~1.0"



        Basic usage is like this:



        $Cli = Cli::getInstance();
        $Cli->setArgument('h', 'help', 'Show this help document');
        //... other arguments
        if($Cli->getArgument('h')) $Cli->printHelpDoc(); //exits


        And so on.



        You can even do it from a PHP config file, which just gets put into setArgument() ~ basically.



        //config.php
        return [
        [
        'shortName' => 'h',
        'longName' => 'help',
        'doc' => 'Show this help document'
        ]
        ];


        Then



         //cli.php

        $config = require 'config.php';

        $Cli = Cli::getInstance();
        $Cli->fromConfig($config);

        if($Cli->getArgument('h')) $Cli->printHelpDoc(); //exits


        You can also do dynamic validation of the input args like this (with a closure):



         $Cli->setArgument('f', 'foo', 'This is just foo, and must always be foo', [
        'accept' => function($shortName, $value)
        if($value == 'foo') return true;
        return false;

        ]);


        The above just returns a Boolean, if the value is good or not. If you return false it will issue an exception, etc. You can also make an argument required like this:



         $Cli->setArgument('i', 'input', 'This is input that requires a value', [
        'requireValue' => true
        ]);


        And of course you can combine those 2.



        There is some documentation on the Github page. It has a few small dependencies, just common stuff that I like to re-use (all in composer). Together it's less then 1000 lines of code. Maybe 20 or 30kb.



        I needed to make a small command line thing, and I had this idea...







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 7 at 0:55

























        answered Mar 7 at 0:43









        ArtisticPhoenixArtisticPhoenix

        17.2k11224




        17.2k11224



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55033522%2fmicro-framework-for-command-applications-to-process-data-either-in-php-or-pytho%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

            Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

            2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived