Giter Site home page Giter Site logo

cakephp-configreadshell's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cakephp-configreadshell's Issues

Add gotcha docs for things that have been `Configure::consume()`d

Cake 3 by default strips a lot of Configure's values out via ::consume(). This is done in config/boostrap.php for:

  • Cache
  • ConnectionManager (Datasources configs)
  • Email (EmailTransport & Email configs)
  • Log
  • Security.salt

Using Configure::consume() is meant to keep the values left in Configure specific to the given app (I guess), but it greatly complicates the process of obtaining environment-specific Configure values for "anything" in the app since those configs need to be fetch by calling the appropriate singleton class instead (example: ConnectionManager::config('default)).

The ConfigReadShell's documentation needs to spell out that if you're trying to get a "consumed" value, it won't work unless you edit your bootstrap.php to use Configure::read() instead of Configure::consume().

Another option is to invoke the Cake ConsoleShell:

$ echo 'use Cake\Datasource\ConnectionManager; ConnectionManager::config("default");'
   | bin/cake Console

Welcome to CakePHP v3.0.7 Console
---------------------------------------------------------------
App : src
Path: /var/www/src/
---------------------------------------------------------------
You can exit with `CTRL-C` or `exit`

Psy Shell v0.4.4 (PHP 5.6.10-1+deb.sury.org~precise+1 โ€” cli) by Justin Hileman
=> [
       "className"        => "Cake\\Database\\Connection",
       "driver"           => "Cake\\Database\\Driver\\Mysql",
       "persistent"       => false,
       "host"             => "localhost",
       "username"         => "vagrant",
       "password"         => "vagrant",
       "database"         => "vagrant",
       "encoding"         => "utf8",
       "timezone"         => "UTC",
       "cacheMetadata"    => true,
       "quoteIdentifiers" => false,
       "name"             => "default"
   ]

Exit:  Ctrl+D

Obviously there's another problem with this, since the ConsoleShell spits out a bunch of other extraneous garbage. This could be mitigated with a --quiet option to suppress that stuff, but that would involve customizing your ConsoleShell instead of your bootstrap.

Probably don't need `composer/installers` under composer v2?

Seems like this might be the cause of composer install creating a /Plugin root folder and installing every package that has a type: cakephp-plugin in their own composer.json into that (tracked) folder.

It's not clear to me how to detect whether this plugin is being composer installed via composer v1 or v2, but on the master / 4.x branch it's probably safe to remove composer/installers from the composer.json file in THIS project.

The issue is fixed when a different project that runs composer require loadsys/cakephp-config-read:~4.0 should NOT end up with a root Plugin/ folder when running composer install.

Add a -s / --serialize command line option.

It would be handy to be able to spit out a sub-section of a Cake app's Configure array in a format that could be consumed by another PHP script easily. This would improve the fidelity of data transfer for things like our Shell Scripts' db-credentials script, which currently uses the ConfigReadShell to dump DB connection values to bash variables, then has to parse that format back into a PHP data structure before spitting it back out in the appropriate format itself.

It'd be great to be able to do something like this from a calling script instead:

<?php
$cmd = escapeshellcmd('bin/cake ConfigRead --serialize Key.SubValueWithSubArrays');
$serialized = [];
$code = 0;
exec($cmd, $serialized, $code);
$data = unserialize($serialized);
echo $data['sub-sub-key']['property'];

Composer autoload error

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing loadsys/cakephp-config-read (2.1.1)
  - Installing loadsys/cakephp-config-read (3.1.1)
    Loading from cache


  [RuntimeException]
  Unable to get primary namespace for package loadsys/cakephp-config-read.
  Ensure you have added proper 'autoload' section to your plugin's config as
  stated in README on https://github.com/cakephp/plugin-installer

Adjust branches, update code/composer and tag new semver for Cake 3.

  • Branch the Cake 2.x compatible plugin into a cake-2.x branch, turn master into Cake 3.x compatible.
  • Update the plugin to work with Cake 3.
  • Update composer.json to be compatible with Cake 3 projects (the conflicting phpunit 3.7 dependency needs to go, for example.)
  • Release a new semver for 3.0.0.

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.