Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emacs-php/ede-php-autoload
PHP autoloading simulation for Emacs' Semantic
https://github.com/emacs-php/ede-php-autoload
emacs emacs-modules emacs-packages php
Last synced: 3 months ago
JSON representation
PHP autoloading simulation for Emacs' Semantic
- Host: GitHub
- URL: https://github.com/emacs-php/ede-php-autoload
- Owner: emacs-php
- Created: 2015-05-23T15:48:40.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-27T07:19:18.000Z (11 months ago)
- Last Synced: 2024-08-05T06:06:15.176Z (6 months ago)
- Topics: emacs, emacs-modules, emacs-packages, php
- Language: Emacs Lisp
- Homepage:
- Size: 126 KB
- Stars: 22
- Watchers: 8
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.org
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
#+TITLE: ede-php-autoload
[[http://melpa.org/#/ede-php-autoload][file:http://melpa.org/packages/ede-php-autoload-badge.svg]] [[http://stable.melpa.org/#/ede-php-autoload][file:http://stable.melpa.org/packages/ede-php-autoload-badge.svg]] [[https://travis-ci.org/emacs-php/ede-php-autoload][file:https://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:- An *EDE project*, =ede-php-autoload=, that defines autoloading
configuration for a project. It is able to parse =composer.json=
files to extract autoloading information from it
- A *SemanticDB backend* that can find a tag by name using the
autoload information of the current =ede-php-autoload= project
- A *minor 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 at =src/MyFirstNs=, and uses the PSR-0 norm
- =MySecondNs=, located at =src/MySecondNs=, and uses the PSR-4 norm
- =ThirdPartyNs=, located at =vendor/third-party/src=, and uses the PSR-4 normDefining this project and its autoload information is done like this:
#+BEGIN_SRC emacs-lisp
(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"))))
#+END_SRCIf you have a =composer.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 your =composer.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
#+BEGIN_SRC emacs-lisp
(add-hook 'php-mode-hook #'ede-php-autoload-mode)
#+END_SRC* Commands
| Name | Description |
|-----------------------------------------+----------------------------------------------------------------|
| ~M-x ede-php-autoload-reload-autoloads~ | Similar 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. See =GPL= for details.