This article is part of my #100DaysOfCode and #100DaysOfBlogging challenge. R1D9

This is part two of a series of articles about the PHP Version Switcher.


Yesterday I started off, moving for my PHP version switcher to a new home by creating a PowerShell module.

Whilst the import of the module and invocation of the function worked, the Import-Module throw a warning:

WARNING: The names of some imported commands from the module ‘Php-VersionSwitcher’ include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.

Obviously, the module and/or function name breaks some PowerShell naming convention. As suggested, I ran Get-Verb which provided following output.

C:\Users\Rueckauer\source> Get-Verb

Verb        Group
----        -----
Add         Common
Clear       Common
Close       Common
Copy        Common
Enter       Common
Exit        Common
Find        Common
Format      Common
Get         Common
Hide        Common
Join        Common
Lock        Common
Move        Common
New         Common
Open        Common
Optimize    Common
Pop         Common
Push        Common
Redo        Common
Remove      Common
Rename      Common
Reset       Common
Resize      Common
Search      Common
Select      Common
Set         Common
Show        Common
Skip        Common
Split       Common
Step        Common
Switch      Common
Undo        Common
Unlock      Common
Watch       Common
Backup      Data
Checkpoint  Data
Compare     Data
Compress    Data
Convert     Data
ConvertFrom Data
ConvertTo   Data
Dismount    Data
Edit        Data
Wait        Lifecycle
Debug       Diagnostic
Measure     Diagnostic
Ping        Diagnostic
Repair      Diagnostic
Resolve     Diagnostic
Test        Diagnostic
Trace       Diagnostic
Connect     Communications
Disconnect  Communications
Read        Communications
Receive     Communications
Send        Communications
Write       Communications
Block       Security
Grant       Security
Protect     Security
Revoke      Security
Unblock     Security
Unprotect   Security
Use         Other

Doing some more research I learned that it’s a convention by starting off with one of the verbs above and appending whatever noun. Also, that PS is a (not so strictly) reserved prefix.

Okay, so I could rename my module to Switch-PhpVersion. As a matter of fact, I changed it and the warning went away. However, these long names bother me a bit. I want to quickly type and execute a command. Now there are currently only 4 Switch-* commands on my machine. But still, I would prefer something shorter.

Commands starting with Switch-

So, I decided to rename module and function etc. to pvs. Which btw is also the current name of the PHP version switcher batch file.

Repository

I’ve created a new repository for this project. To follow along and view the current state, head over to https://github.com/arueckauer/pvs.