Home Download Buy Blog Forum Support

PHP Completions

PHP Completions

Postby agibsonsw on Mon Jun 11, 2012 10:07 pm

I'm on Build 2181 so I'm unsure if PHP.sublime-completions has been updated recently. Nevertheless, I'm revising this file - see my GitHub.

The most significant difference is that I've commented out a (very) large number of "libraries". They have been moved to PECL extensions' control anyway, and I don't want them to display by default. If I decide to use them I will just un-comment the relevant section in my completions file. There is a text file on my GitHub with more details, including a list of the extensions I have commented-out, and other information.

I've added in a (v. large) number of new functions;
I've switched the order of the mysql functions with their mysqli versions;
I've updated lots of parameters (but I haven't managed all of them yet!);
I've favoured the correct (Pascal) casing for classes, interfaces and exceptions;
I've mainly kept the procedural' functions, rather than their OO equivalent methods, except for the DOM library (where I've done the reverse).
[Adding all the OO-methods will make the file twice as large..]

NB If you update to a future build you may find that PHP.sublime-completions is added, or over-written, so you might keep a copy of my version separately.

If you spot any typos, or have any suggestions, I will be glad to hear from you :)
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: PHP Completions

Postby agibsonsw on Mon Jun 11, 2012 11:07 pm

PS I'm attempting to strike a balance when supplying parameters: that is, between providing useful information, and not being over-whelming/overly fastidious.

For example, I occasionally use expressions like ${1:host_etc} to indicate that there are other parameters, but perhaps they are not used much, or are quite detailed.
Similarly, when the allowed combination(s) of parameters are too many, I may just leave the cursor within the braces ().

For class (interfaces, exceptions, etc.) that do not have a constructor I've just added their PascalCase name, otherwise I've included their constructor as well.

Again, I welcome any comments/suggestions. Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: PHP Completions

Postby Fed03 on Wed Jun 13, 2012 1:30 pm

i'll make u a statue made of gold and silver XD
Fed03
 
Posts: 79
Joined: Sun Oct 16, 2011 6:38 pm

Re: PHP Completions

Postby agibsonsw on Wed Jun 13, 2012 5:31 pm

Fed03 wrote:i'll make u a statue made of gold and silver XD


Thank you, although I'd rather you just give me the gold and the silver :D - I'll buy a hammer and knock up a statue myself :lol:

I've updated it (on GitHub) with a load more parameters, and class-names (properly cased) and constructors.

If you, or someone, know which library(ies)/extensions are most popular I might add the OO-methods for it to my file. Andy.

Added: Actually, the most popular "extension" must be mysqli. I think I'll add these methods; I'll group them ahead of their
procedural equivalents, as the OO approach is recommended (and easier to type ;) )

I may not bother adding OO-methods for other extensions, unless someone requests that I do.. Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: PHP Completions

Postby agibsonsw on Wed Jun 13, 2012 9:34 pm

I've just updated my repo, as follows:

Added mysqli (OO) methods;
Commented out mysql (in favour of mysqli);
Filled out more parameters for: sqlite, sqlsvr, xmlwriter (for the procedural functions).

I'll leave it alone for a while, unless someone expresses an interest in a particular extension - or anyone spots any typos :lol:

I hope it strikes the right balance between providing the most useful functions, and parameters, and not over-whelming the completions list. [A reminder that a lot of extensions are commented out in the completions file - just uncomment any that you might use.]

Feedback welcome. Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: PHP Completions

Postby Fed03 on Thu Jun 14, 2012 8:16 am

i think that pdo it's a little bit less popular than mysqli but exponentially growing and far better^
Fed03
 
Posts: 79
Joined: Sun Oct 16, 2011 6:38 pm

Re: PHP Completions

Postby agibsonsw on Thu Jun 14, 2012 1:18 pm

Fed03 wrote:i think that pdo it's a little bit less popular than mysqli but exponentially growing and far better^


I've updated to include PDO and PDOStatement methods. I've also added mysqli pre-defined constants. Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: PHP Completions

Postby agibsonsw on Fri Jun 15, 2012 10:55 pm

Nudge If anyone notices any mistakes :lol: , or has suggestions, about this file, can I encourage you to get in touch - either here or via my repo.

Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: PHP Completions

Postby agibsonsw on Sat Jun 16, 2012 11:02 pm

Just to note that I've commented out the global variables - $_POST, etc. The dollar sign causes misbehaviour.
This is not much of a loss as they will appear in the completions-list anyway, under normal file-completion rules.

Also, here's a sensible piece of advice: rather than deleting the comment lines when you wish to use a particular extension, do this:

Code: Select all
/* My note(s) here UNCOMMENTED */
// the completions are listed here
/* UNCOMMENTED */

This will make them much easier to find when you later want to disable (comment) them.

BTW I've now commented-out the Mongo library as it is no longer bundled with PHP.

Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: PHP Completions

Postby agibsonsw on Thu Jun 21, 2012 1:16 am

I'm hoping that my PHP completions file is pretty much complete now, but I will still welcome any comments or suggestions to improve it (if possible :D ).

I've added OO methods for XMLReader, XMLWriter and XSLTProcessor. I haven't commented-out their procedural/function equivalents as I've no idea whether people still use them :?:

For 30 specific functions I've created two versions. For example:

Code: Select all
{ "trigger": "mkdir()", "contents": "mkdir(${1:pathname})$0" },
{ "trigger": "mkdir(full)", "contents": "mkdir(${1:pathname}${2:[, mode]}${3:[, recursive]}${4:[, context]})$0" },

Mostly this is applied to database connect() functions. I believe this should be useful, so that we don't spend too much time deleting optional parameters that we rarely need.

The GitHub

It is a shame not to receive much input (validation, he, he) from this forum, but this doesn't prevent me from being pleased with my resultant file. Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Next

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 10 guests