slimphp / slim-console Goto Github PK
View Code? Open in Web Editor NEWSlim Framework Console
Home Page: https://slimframework.com
License: MIT License
Slim Framework Console
Home Page: https://slimframework.com
License: MIT License
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.
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
?
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>]...
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?
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.
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:
slim/psr7
but choices would be (Laminas, Guzzle or Nyholm)php-di/php-di
but choices would be (Pimple or overridden by user input)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!
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.
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
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:
We should enable populating that object using:
What should the configuration files be named?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.