A list of amazingly awesome PHP libraries, resources and shiny things.
- Composer/Packagist - A package and dependency manager.
- Composer Installers - A multi framework Composer library installer.
<?php | |
$color = new Zend_Form_Element_Text('color'); | |
$color->AddValidator('Regex',false,array('/^\#[a-f0-9]{6}$/i')); | |
$color->getValidator('Regex')->setMessages( array( | |
Zend_Validate_Regex::NOT_MATCH => | |
'\'%value%\' is not valid. Use a value in the form of #112233' | |
)); |
<?php | |
/* In your controller action */ | |
class search extends Zend_Controller{ | |
public function searchResultsAction() | |
{ | |
$request = $this->getRequest(); | |
$sort = $request->getParam('sort','date'); | |
$this->view->sort = $sort; | |
$pageSize = (int) $request->getParam('pagesize',10); |
dojo.query('#teamMemberInvitesList input[type=checkbox]').forEach( | |
function(node){ | |
var checkbox = dijit.getEnclosingWidget(node); | |
if(checkbox){ | |
checkbox.attr('checked',false); | |
} | |
} | |
); |
<!-- In some controller, etc somewhere --> | |
<?php | |
// Say you find yourself with a big array of data | |
$messageList = $email->getCompetitionMessages($competition); | |
// but you want to filter out anything from the admin | |
$messageList = array_filter($messageList,new Istart_Filter_ValueInObjectArrayFilter('fromEmail','admin@example.com')); | |
// Or, if < PHP 5.3 |
function setFormState(disabled){ | |
dijit.registry.forEach(function(w){ | |
if(w.name.search(/application/i) >= 0){ | |
w.disabled = disabled; | |
w.focus(); | |
} | |
}); | |
} |
<?php | |
//if the post has a parent | |
$title = ""; | |
global $post; | |
if($post->post_parent){ | |
//collect ancestor pages | |
$relations = get_post_ancestors($post->ID); | |
//add current post to pages | |
array_push($relations, $post->ID); |
A list of amazingly awesome PHP libraries, resources and shiny things.
// Still trying to get the handle on JS OO - WAY too many years in C++ style languages I guess | |
// Anyway, for looking at later | |
function Collection() { | |
this.nextNewId = 1; | |
this.count = 0; | |
this.data = {}; | |
} | |
Collection.prototype.getAll = function(){ |
config.vm.provision :puppet do |puppet| | |
puppet.facter = { | |
"hack=hack LANG=en_US.UTF-8 hack" => "hack", | |
'fqdn' => "#{config.vm.hostname}", | |
'ssh_username' => "#{ssh_username}", | |
'provisioner_type' => ENV['VAGRANT_DEFAULT_PROVIDER'], | |
} | |
puppet.manifests_path = "#{data['vm']['provision']['puppet']['manifests_path']}" | |
puppet.manifest_file = "#{data['vm']['provision']['puppet']['manifest_file']}" | |
puppet.module_path = "#{data['vm']['provision']['puppet']['module_path']}" |
I'm always on the lookout for great ways to answer the question "How do I get started in PHP?" Sometimes, the hardest part is figuring out the server side of it, and everything you need to build something.
Homestead is a pre-configured, virtual server in a box. Easy to add to your project and has probably more services than you need but things you maybe haven't tried because you didn't know how to install them.
It is not a replacement for tools like Ansible|Chef|Puppet or even Docker--you can use those tools to script building not only your dev VM, but testing and production servers as well. But if you are looking for a quick way to add a dev VM to your project, or don't yet know the difference between Postfix and clearfix--those bigger tools can wait.
Install