Sometimes you want to add a block programmatically when you create a page. This recipe shows you how to add a content block the the home page.
$homePage = Page::getByID(HOME_CID);
$contentBlockType = BlockType::getByHandle('content');
// block data, specific for each block, check db.xml or controller of block
// get more information about the necessary parameters.
$blockData = array('content' => 'My content');
// add block to Main area
$homePage->addBlock($contentBlockType, 'Main', $blockData);