Giter Site home page Giter Site logo

slim-console's Introduction

Slim Console

Build Status Coverage Status

Installation

It's recommended that you use Composer to install Slim Console.

$ composer require slim/console:^0.1

This will install Slim Console and all required dependencies. Slim Console requires PHP 7.2 or newer.

License

The Slim Console is licensed under the MIT license. See License File for more information.

slim-console's People

Contributors

abgeo avatar adriansuter avatar dependabot-preview[bot] avatar dependabot[bot] avatar faissaloux avatar l0gicgate avatar ryannerd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slim-console's Issues

Console Framework / Task Runner Framework

As per the original thread we discussed a few different frameworks that we could use as the underlying console runners. Namely:

Console Runners

Task Runners

We seemed to have more positive feedback around symfony/console. I am very familiar with their system and they will be providing long term support for the repo but let's look at the dependency overhead:

{
    "require": {
        "php": "^7.2.5",
        "symfony/polyfill-mbstring": "~1.0",
        "symfony/polyfill-php73": "^1.8",
        "symfony/polyfill-php80": "^1.15",
        "symfony/service-contracts": "^1.1|^2",
        "symfony/string": "^5.1"
    }
}

On the other hand we have phpleague/climate but my concern is that the package is soon going to go unmaintained. The repository has issues/PRs that go back all the way to 2014:

{
    "require": {
        "psr/log": "^1.0",
        "php": "^7.1",
        "seld/cli-prompt": "^1.0"
    }
}

I'm open to other suggestions for frameworks / task runners.

External User Commands

I would like for the console to be easily extensible by the end user. How would we go about this?

I was thinking that we could establish a project base level directory that would give a plugin interface to the user to add commands to the existing console.

Should we make a folder where we loop through files and add the commands in those files? Or could we have the CLI look for ../../commands/external.php which would return an array of user defined commands so we can then call $this->addCommands($external) within the Application class

Init / Setup Command

As per my comment in the original thread, I would like to have discussions about the functionality and structure of each command. In this case, this comment would do the following:

  • Create public directory (this is overridable from user input)
  • Ask if they want to install a PSR-7/Server Request Creator implementation, default slim/psr7 but choices would be (Laminas, Guzzle or Nyholm)
  • Ask if they would like to install a dependency container, default would be php-di/php-di but choices would be (Pimple or overridden by user input)
  • Ask if they would like to setup PSR-3 logging, default would be Monolog, I'm open to other suggestions here.
  • Setup composer.json with project name, copyright, license, scripts and PSR-4 autoload namespacing

As for initial directory structure we should stick to something like Slim-Skeleton:

app
|--dependencies.php
|--middleware.php
|--routes.php
|--settings.php

logs
|--*empty*

public
|--index.php

src
|--*empty*

tests
|--bootstrap.php

.gitignore
composer.json
phpunit.xml

Please provide some input y'all!

Composer: Requirements could not be resolved to an installable set of packages

I tried to install the Slim-Console today. But composer could not resolve an installable set of packages.

- phpstan/phpstan 0.11.19 requires symfony/console ~3.2 || ~4.0 -> satisfiable by symfony/console[3.2.x-dev, 3.3.x-dev, 3.4.x-dev, 4.0.x-dev, 4.1.x-dev, 4.2.x-dev, 4.3.x-dev, 4.4.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-R
C2, v3.2.1, v3.2.10, v3.2.11, v3.2.12, v3.2.13, v3.2.14, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6, v3.2.7, v3.2.8, v3.2.9, v3.3.0, v3.3.0-BETA1, v3.3.0-RC1, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.15, v3.3.16, v3.3.1
7, v3.3.18, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.0-BETA1, v3.4.0-BETA2, v3.4.0-BETA3, v3.4.0-BETA4, v3.4.0-RC1, v3.4.0-RC2, v3.4.1, v3.4.10, v3.4.11, v3.4.12, v3.4.13, v3.4.14, v3.4.15, v3.4.1
6, v3.4.17, v3.4.18, v3.4.19, v3.4.2, v3.4.20, v3.4.21, v3.4.22, v3.4.23, v3.4.24, v3.4.25, v3.4.26, v3.4.27, v3.4.28, v3.4.29, v3.4.3, v3.4.30, v3.4.31, v3.4.32, v3.4.33, v3.4.34, v3.4.35, v3.4.36, v3.4.37, v3.4.38, v3.4.39, v3.4.4
, v3.4.5, v3.4.6, v3.4.7, v3.4.8, v3.4.9, v4.0.0, v4.0.0-BETA1, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.0-RC1, v4.0.0-RC2, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.14, v4.0.15, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6,
v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.0-BETA1, v4.1.0-BETA2, v4.1.0-BETA3, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.0, v4.2.0-BETA1, v4.2.0-BETA2, v4.2.0-RC1, v4.2.1, v4.
2.10, v4.2.11, v4.2.12, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9, v4.3.0, v4.3.0-BETA1, v4.3.0-BETA2, v4.3.0-RC1, v4.3.1, v4.3.10, v4.3.11, v4.3.2, v4.3.3, v4.3.4, v4.3.5, v4.3.6, v4.3.7, v4.3.8, v4.3.9, v4.4.0
, v4.4.0-BETA1, v4.4.0-BETA2, v4.4.0-RC1, v4.4.1, v4.4.2, v4.4.3, v4.4.4, v4.4.5, v4.4.6, v4.4.7] but these conflict with your requirements or minimum-stability.

Do we need to upgrade phpstan to ^0.12.19?

Configuration Object

We are going to need to create a global configuration object to keep track of paths and other settings.

It will need to keep track of these items:

  • Source path (default: src)
  • External commands path (default: Application/Commands as established in #3)
  • Public index path (default: public/index.php)
  • Bootstrap directory (default: app)
    Not sure if we do need all of these, I'm just brainstorming)

We should enable populating that object using:

  • JSON Configuration
  • YAML Configuration
  • PHP Configuration
  • Env Variables (These will always take precedence over all others)

What should the configuration files be named?

  • slim.config.(json|yaml|php)?

Error Installing on php 8+

I am getting the following error when I am trying to install with php 8.0.14

$ composer require slim/console     

                                                                                                                  
  [InvalidArgumentException]                                                                                      
  Package slim/console has requirements incompatible with your PHP version, PHP extensions and Composer version:  
    - slim/console 0.1 requires php ^7.2 which does not match your installed version 8.0.14.                      
                                                                                                                  

require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>]...

Custom Templates for Integration Commands

After discussing with @JustSteveKing on Slack, I was thinking that we could enable the console user to maybe create components like route handlers and migrations.

Would we be able to provide the default action template from Slim-Skeleton and optionally the option for them to provide their own templates for those commands via the configuration object or other?

When creating X Component use X Template or fall back on Default

Thoughts?

Composer package not found

When I run composer require slim/console:^0.1 I get the following error:

[InvalidArgumentException]                                                                                                                        
Could not find a matching version of package slim/console. 
Check the package spelling, your version constraint and that the package is available  
in a stability which matches your minimum-stability (stable).      

I also tried to add "minimum-stability": "dev", to my composer.json file.

It looks like the package does not exist on packagist: https://packagist.org/search/?q=slim/console

No packages found.

Slim CLI?

Hello,

I think it would be nice to create a new Slim component - CLI Console (like Symfony Console), to start the PHP Dev server, Debug router and Container, Generating Routes and Actions etc.

If you agree with me, I can immediately start working on it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.