Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PHP autoloading simulation for Emacs' Semantic

NotificationsYou must be signed in to change notification settings

emacs-php/ede-php-autoload

Repository files navigation

http://melpa.org/packages/ede-php-autoload-badge.svghttp://stable.melpa.org/packages/ede-php-autoload-badge.svghttps://travis-ci.org/emacs-php/ede-php-autoload.svg

Description

This project simulates PHP autoloading system to use it in Semantic. It is composed of 3 parts:

  • AnEDE project,ede-php-autoload, that defines autoloading configuration for a project. It is able to parsecomposer.json files to extract autoloading information from it
  • ASemanticDB backend that can find a tag by name using the autoload information of the currentede-php-autoload project
  • Aminor mode,ede-php-autoload-mode, that enables the SemanticDB backend for a buffer.

Defining autoloads for a project

Let’s assume we have a project located at/home/me/my-project. It has 3 namespaces:

  • MyFirstNs, located atsrc/MyFirstNs, and uses the PSR-0 norm
  • MySecondNs, located atsrc/MySecondNs, and uses the PSR-4 norm
  • ThirdPartyNs, located atvendor/third-party/src, and uses the PSR-4 norm

Defining this project and its autoload information is done like this:

(ede-php-autoload-project"My project":file"/home/me/my-project/main.php":class-autoloads '(:psr-0 (("MyFirstNs"."src/MyFirstNs")):psr-4 (("MySecondNs"."src/MySecondNs")                                                     ("ThirdPartyNs"."vendor/third-party/src"))))

If you have acomposer.json at the root of your project, its autoload information (and also the one in the composer dependencies) will be merged with the information you put in:class-autoloads.

If yourcomposer.json contains all the autoload information, and you have nothing to add in:class-autoloads, you don’t have to define an EDE project by hand. It will be automatically created when you visit a file in your project.

Enabling the SemanticDB backend in php buffers

(add-hook'php-mode-hook#'ede-php-autoload-mode)

Commands

NameDescription
M-x ede-php-autoload-reload-autoloadsSimilar to the reindexation in IDEs. Use it when your composer configuration changed to reload the autoloads.

License

This project is released under the GPL v3 license. SeeGPL for details.

About

PHP autoloading simulation for Emacs' Semantic

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors6


[8]ページ先頭

©2009-2025 Movatter.jp