{"id":13861587,"url":"https://github.com/emacs-php/php-auto-yasnippets","last_synced_at":"2025-07-14T09:32:33.972Z","repository":{"id":6839413,"uuid":"8087871","full_name":"emacs-php/php-auto-yasnippets","owner":"emacs-php","description":"Dynamically Generated YASnippets for PHP Code in GNU Emacs","archived":true,"fork":false,"pushed_at":"2017-03-31T01:15:16.000Z","size":115,"stargazers_count":41,"open_issues_count":5,"forks_count":12,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-08-05T06:03:26.904Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emacs-php.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-08T05:01:47.000Z","updated_at":"2023-10-19T10:08:41.000Z","dependencies_parsed_at":"2022-09-13T03:02:13.003Z","dependency_job_id":null,"html_url":"https://github.com/emacs-php/php-auto-yasnippets","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emacs-php%2Fphp-auto-yasnippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emacs-php%2Fphp-auto-yasnippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emacs-php%2Fphp-auto-yasnippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emacs-php%2Fphp-auto-yasnippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emacs-php","download_url":"https://codeload.github.com/emacs-php/php-auto-yasnippets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225968844,"owners_count":17553146,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-05T06:01:25.657Z","updated_at":"2024-11-22T21:30:50.874Z","avatar_url":"https://github.com/emacs-php.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"Automatic YASnippets for PHP in Emacs\n=====================================\n\nThe php-auto-yasnippets package for [GNU Emacs][emacs] will\nautomatically create ‘snippets’ for [standard PHP functions][php].  It\ndefines these snippets using the [YASnippet package][yas], with optional\nsupport for [auto-complete][auto-complete].  For\nexample, if you type the PHP function\n\n```php\nimplode\n```\n\nand press `C-c C-y` then php-auto-yasnippets will expand that into\n\n```php\nimplode($glue, $pieces)\n```\n\nwith the cursor ready to overwrite `$glue` with the string you want to\nuse.  Pressing Tab will skip over to `$pieces` to do the\nsame.  This way you can be sure you not only have the correct number\nof arguments, but also that you have them in the correct order.  PHP\ncomes with a large standard library and functions that sound similar\nsometimes require arguments in contrasting orders.  This package will\nhelp you avoid having to remember those corner cases.\n\nIf a function has any optional parameters then php-auto-yasnippets\nwill wrap them in square braces.  This is the same convention the PHP\nmanual uses to indicate optional parameters.  For example,\nphp-auto-yasnippets will expand `filter_input` into this:\n\n```php\nfilter_input($type, $variable_name, [$filter], [$options])\n```\n\nIf you do not need the optional parameters you can delete them by\npressing `C-d` when you Tab over to them.\n\nYou can use the prefix command to expand method names.  When you use\nthe prefix, u.g. `C-u C-c C-y`, the package will ask you for the name\nof the class which implements that method.  This information is\nnecessary in order to generate the correct snippet.\n\nRequirements\n------------\n\n* PHP 5.3 or later\n* [YASnippet][yas]\n* [php-mode][php-mode]\n\nInstallation\n------------\n\nTo use php-auto-yasnippets you need to do three things.  First, place\nthe package in your load-path (`C-h v load-path` for help) and load it\nfrom your Emacs configuration file by adding:\n\n```lisp\n(require 'php-auto-yasnippets)\n```\n\nSecond, make sure the variable `php-auto-yasnippet-php-program` points\nto the program `Create-PHP-YASnippet.php`.  That PHP program should\nhave come with this package; if you do not have it then you can get it\nfrom the [project website][home].  By default php-auto-yasnippets will\nsearch for the PHP program in the same directory as the Elisp code,\ni.e. the `php-auto-yasnippets.el`.  If you want to put the PHP program\nin another place then use `setq` in your configuration file to set the\nvariable to the proper path, e.g:\n\n```lisp\n(require 'php-auto-yasnippets)\n(setq php-auto-yasnippet-php-program \"~/path/to/Create-PHP-YASnippet.php\")\n```\n\nFinally, bind the function `yas/create-php-snippet` to a key of your\nchoice.  You *must* do this because php-auto-yasnippets defines no\nkey-bindings.  And since the package requires php-mode, and is most\nuseful when writing PHP code, you may want to use a key-binding that\nonly works when using php-mode.  For example:\n\n```lisp\n(define-key php-mode-map (kbd \"C-c C-y\") 'yas/create-php-snippet)\n```\n\nNow if you type the name of a PHP function and press `C-c C-y` it will\nexpand into a snippet containing all of the parameters, their names,\nany default values, et cetera.\n\n\nauto-complete\n-------------\n\nWith auto-complete support activated, it's even simpler:\n\n```php\nimp\n```\n\nfollowed by `Tab`, then `Return` (to choose the first completion) expands the\nsnippet to\n\n```php\nimplode($glue, $pieces)\n```\n\nFirst, install and configure [auto-complete][auto-complete].\n\nAdd\n\n```lisp\n(payas/ac-setup)\n```\n\nto your php-auto-yasnippets setup, and you should be good to go.\n\nNote that auto-completion does not support user-defined functions or\nclasses (it relies on auto-complete's php-mode dictionary of functions).\n\n\nLoading User Code\n-----------------\n\nThis package can also generate snippets for user-defined functions and methods.\n\nYou can tell a buffer what files to load for function and class definitions by\nsetting `php-auto-yasnippet-required-files` to a list of required paths.\n\nIf you use [Composer](http://getcomposer.org/), you might put something like\nthis in `~/project/.dir-locals.el`:\n\n```lisp\n(php-mode . ((php-auto-yasnippet-required-files (list \"~/project/vendor/autoload.php\"))))\n```\n\nNow you can generate snippets for any classes Composer autoloads, in any PHP\nfile in the project.\n\n\nContributors\n------------\n\n* [Glynn Forrest](http://glynnforrest.com)\n* [Yasuyuki Oka](http://yasuyk.github.io/)\n* [Steve Purcell](http://www.sanityinc.com/)\n* [Nate Eagleson](http://www.nateeag.com/)\n* [Alessandro Madruga Correia](https://github.com/amcorreia)\n* [Michel Bystranowski](https://github.com/bystrano)\n* [Martin Tang](https://github.com/MarTango)\n\n\nMiscellaneous\n-------------\n\nThis package uses [Semantic Versioning][semver].\n\n\nLicense\n-------\n\n[GNU General Public License][gpl]\n\nCopyright 2013, 2014, 2015, 2016, 2017 Eric James Michael Ritz\n\n\n\n[emacs]: http://www.gnu.org/software/emacs/\n[php]: http://php.net/\n[yas]: https://github.com/capitaomorte/yasnippet\n[auto-complete]: https://github.com/auto-complete/auto-complete\n[php-mode]: https://github.com/ejmr/php-mode\n[gpl]: http://www.gnu.org/copyleft/gpl.html\n[home]: https://github.com/ejmr/php-auto-yasnippets\n[semver]: http://semver.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femacs-php%2Fphp-auto-yasnippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femacs-php%2Fphp-auto-yasnippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femacs-php%2Fphp-auto-yasnippets/lists"}