Why is PHP Awesome
-
Upload
jeremy-coates -
Category
Technology
-
view
5.644 -
download
0
description
Transcript of Why is PHP Awesome
@magma_digital
Why PHP Is AwesomeHonest.
@magma_digital
The Team
@magma_digital
Speaking today
Jeremy Coates @phpcodemonkey
Steph Cook @stephcook22
Damien Walsh @themainframe
@magma_digital
– w3techs.com
“PHP is used by 81.8% of all the websites whose server-side programming language we
know.”
@magma_digital
@magma_digital
So why the reputation
@magma_digital
PHP has moved on.
@magma_digital
The dark ages…
@magma_digital
//genearate a filename... $fn_temp = preg_replace("/[^a-zA-Z0-9\s]/", "", $_POST[‘f_n’]);
//Does it exist? while(file_exists("/home/cocoder/.data/{$fn_temp}{$n}/")) $n++;
?> <h1>Project Created!</h1> <?php //DB... $return_id = cc_core::make_project( $_POST['n_name'], ($fn_temp.$n), $_SESSION['user_id'] ); ?>
i
Magic strings…
Suddenly… HTML
Highly procedural
@magma_digital
Now…
@magma_digital
public function editAction(Request $request) { $this->form->handleRequest($request); $entity = $this->form->getData();
if ($this->form->isValid()) { $this->em = $this->doctrine->getManager(); $this->em->persist($entity); $this->em->flush(); } return $this->render( ‘TestBundle:Items:edit.html.twig', array( 'entity' => $entity, 'form' => $this->form->createView() ) ); }
Interact with Model
Render View
@magma_digital
The cool stuffTo make your projects easier
@magma_digital
@magma_digital
curl -sS https://getcomposer.org/installer | php
Composer
@magma_digital
{ "require": { "monolog/monolog": "1.2.*" }}
Composercomposer.json:
@magma_digital
Composerinclude ‘classes/Foo.class.php’; include ‘classes/Bar.class.php’; include ‘classes/OtherStuff.class.php’; include ‘classes/MyClass.class.php’; include ‘classes/AnotherClass.class.php’;
@magma_digital
Composer
include ‘vendor/autoload.php’;
... $foo = new Foo();
@magma_digital
Silex
@magma_digital
{ "require": { "silex/silex": "~1.1" }}
Silexcomposer.json:
@magma_digital
Silexrequire_once __DIR__ . '/../vendor/autoload.php';
$app = new Silex\Application();
$app->get('/hello/{name}', function($name) use($app) {
return 'Hello '.$app->escape($name);
});
$app->run();
Fire up composer.
Create the App
Run it.
Be safe!
Add a route
@magma_digital
Twig
@magma_digital
<ul>
{% for user in users %} <li> {{ user.name }} </li> {% else %} <li> <strong>No users have been found.</strong> </li>{% endfor %}
</ul>
Twig
@magma_digital
@magma_digital
Xdebug!Install the extension Install the browser extension Setup for integration with IDE (NetBeans, PHPStorm) Press Play Refresh your page Profit
@magma_digital
Codeception
@magma_digital
$I = new WebGuy($scenario); $I->wantTo('create a wiki page'); $I->amOnPage('/'); $I->click('Pages'); $I->click('New'); $I->see('New Page');
Codeception
@magma_digital
Full Stack FrameworksSymfony2 & Zend Framework 2
@magma_digital
@magma_digital
@magma_digital
Types of Projects
@magma_digital
@magma_digital
Manchester Digital has revealed that 32% of digital organisations in the region were forced
to refuse work in 2013 due to a lack of resource, despite 83% of businesses experiencing
growth.
@magma_digital
Get involved!
@magma_digital
@magma_digital
PHPNW
@magma_digital
Have we convinced you yet