Skip to content
This repository has been archived by the owner on Jul 22, 2019. It is now read-only.

PHP Projects config (phpconfig.json) + Autoloader resolution #64

Open
edgebal opened this issue Jun 8, 2016 · 6 comments
Open

PHP Projects config (phpconfig.json) + Autoloader resolution #64

edgebal opened this issue Jun 8, 2016 · 6 comments
Labels

Comments

@edgebal
Copy link

edgebal commented Jun 8, 2016

As VSCode natively does for Javascript Projects, it would be nice that Crane supports defining a phpconfig.json file with project-related configurations.

Examples

CakePHP 3.x:

{
  "psr-4": {
    "App\\": "src/",
    "OtherThing\\": "extras/my_other_thing/"
  }
}

CodeIgniter

// CodeIgniter
{
  "files": [
    "system/**/*.php",
    "application/**/*.php"
  ]
}

Some key points:

  • If no phpconfig.json is present in the project, PHP files should be treated as independent units unless there is a require or include statement. This means auto-completion only for local scope. Crane should not process and parse the whole project folder until it has said configuration file created.
  • Ideally Crane should check (and watch) either /composer.lock or /vendor/composer/installed.json for additional "autoload" rules that will be merged with phpconfig.json ones. The later having priority over composer ones. Composer's vendor folder and installed.json paths can be specified by the user on phpconfig.json.
  • Crane should hint/suggest the user to create phpconfig.json when opening a PHP file that has a use or namespace statement.
  • Applies as solution to Setting to include additional 3rd party dependencies (for code completion) #58

Thanks!

@lesydat
Copy link

lesydat commented Jun 8, 2016

I used "PHP Designer" editor, simple it show list of files that defined a same function when we using "Go to Definition" features. I think that feature useful for us

@nevadascout
Copy link
Member

Thanks for the suggestion, I've added this to the feature backlog.

@ADmad
Copy link

ADmad commented Jun 13, 2016

composer is the de-facto package manager for PHP these days. So a good start would be relying on composer's config and autoloader files.

@ADmad
Copy link

ADmad commented Jun 13, 2016

And support for @property, @method tags in docblocks :)

@nevadascout
Copy link
Member

As of #77, it would be great to be able to ignore files and folders for parsing as well.

@TheColorRed
Copy link
Contributor

I have created a blueprints thread #118

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants