- PHP 7 is amazing
- Drupal 8, Symfony 3, Magento 2, Laravel 3, PHPUnit 5, Zend Framework 3 are all dropping by the end of the year
- Really need to brush up on my OOP skills, all the cool kids are doing it
- Open source is continuing to grow in government (including Drupal)
- Literally everyone here has a CI process (build tool, automated testing, automated deployment)
- Vagrant/docker
- Be a good community member, be a human being; don't be a dick
- WordPress is huge (25% of top 10 million sites) and they're starting to catch up technologically.
- WordPress Rest API
- Composer
- big kid toys
- Drupal is well respected in the PHP community
- As is MediaCurrent
Andrew Nacin
U.S. Digital Service - High level government team for assessing government software projects. Andrew shares what they've accomplished and what he's learned in his year spent with USDS
- e.g. fixing healthcare.gov
- Bring best practices into government software projects
- Actual best practices, like from the private sector
- WordPress powers 25% of top 10 million sites
- Created a "playbook" for successful development process
- Building successful teams
- Flexible hosting environments
- Defaulting to open source
- Being more open about software development. i.e. use github, share contributions back, be more transparent
- A strong focus on real time monitoring in government now
- Dashboards that execs can access to get real time feedback on software products
- Worked to help the team building ELIS - (ELectronic Immigration System)
- Bringing technological solution to immgration process
- Currently tons and tons of paper and giant mainframes
- long process, costly process
- Mandated all projects in gov use https
- Pushing open source
- Cobolt is still a challenge
- All the cobalt engineers are reaching retirement age
Eugene Cook
Bringing "modern development" practices to WP development
- Frustations in WP Development
- No code seperation, not MVC or DI
- So many plugins, hard to manage
- Lack of abstraction
- repetition
- No 3rd party standards
- Not great developer experience
- 12 factor - concepts of a well developed projects
- Challenges
- dev on boarding
- dependency management
- config management
- Build process
- Bedrock
- Modularly built developed WP using many best practices
- Composer based
- library & code separation
- autoloading
- build process
- Modularly built developed WP using many best practices
- Composer
- Deployment tool
- Rocketeer
- PHP task runnner used for Deployment
- based off capistrano (built in ruby)
Colin O'Dell
- Weak
- Can pass variables as typed parameters where conversions are possible.
- int can become a float
- object with __toString() can be converted to string
- Can pass variables as typed parameters where conversions are possible.
Strong
declare(strict_type=1);
function getAuthor(): UserInterface {
return 'Chris'
}
getAuthor();
// Error b/c you attempted to the return value is not instance of UserInterface
- Can allow NULL return Type
- RFCs are open to allow for void and null return types
"Space ship operator"
<==>
Returns 0 if both expresiions are equal 1 if left is greater -1 if left is lesser
- Can be used to compare arrays
- compares index by index.
- Compares arrayA[0] to arrayB[0]
- find first difference and returns value or compares all indexes until all are found equal and it returns 0
- compares index by index.
- Use case: sorting arrays using usort() or other array sort functions
??
Allows for checking for null value in comparison ternaries
$value = $_GET['date'] ?: $date //E_NOTICE
$value = $_GET['date'] ?? $date
(0x2603)
$snowman = "\u{2603}";
Similar use case to anonymous functions but with classes
$httpClient->setLogger(new class implements loggerInterface {
file_put_contents($file);
});
- Doesn't require adding a file, namespacing, injecting it into the DI container
- Can quickly create mock objects when unit testing
random_bytes(int $lenth)
random_int(int $min, int $max)
- Creates cryptographically secure randomly generated numbers
- replaces
rand()
- Doesn't require an extension
- Supports system level random generating functionality
Changes and Improvements
- Performances
- Fuck yea!
- php 7 is on par with hhvm now
- PHP ng (next generation initiative)
- Uniform Variable Syntax
- Now longer parsing variables from right to left
- Allow for things like
$$foo()['bar']()
- Allow for things like
- Can cause backwards compatiable
$foo->bar['baz'];
now is interpreted as($foo->bar)['baz'];
- Now longer parsing variables from right to left
- semi reserved words
- can now use reserved words as properties and method names
- PHP 7 can detect context when it encounters key words
- can now use reserved words as properties and method names
- Error Handling and Exception
- Fatal and recoverable errors are now thrown like exceptions
- Not pokemon
- Do NOT try to catch them all
- Unserialize method
- Deals with security vulnerabilities when unserializing data
Depreciated and removed
Test code in php 5.6 for deprecated notices
- Depreciation of PHP4 contructors
- deprecation of salt option for
password_hash()
- Removal of previously-deprecated features
- instaniate objects by reference
- php ini comments
# old comments
; new comments
- Removal of alt php tags
<% // %>
- Reclassification of E_STRICT notices
- ex some E_STRICT notices are now E_DEPRECATED
Installing PHP7
Brace yourself, PHP 7 is scheduled for release on Nov 26
- Ubuntu
- There's a ppa with precompiled PHP7
- pre compiled
- php7.zend.com
- docker file
- bin
- php7.zend.com
- mac
- phpbrew
Upgrade guide
- http://www.php7book.com/phpworld
- RFCs that led to php7
- The google machine
Tessa Mero
- Joomla comes from "Jumla" which is Swahili for "All Together"
- Key Components for leading an open source community
- Community and Leadership
- Documentation and Transparency
- Code of Coducts are a thing
- Don't be a dick
- Now we've documented that we've said "dont be a dick"
- Don't be a dick
- Other people are people, treat them like people
Andreas Hucks @meandmymonkey
- Symfony Versions
- standard
- 8 Months of bug Supports
- LTS
- 2 years of Support
- standard
- Uses semmantic versioning
- Dropped backwards compatibility and depreciated code
- If you're using 2.8 and aren't using depreciated code migration to 3.0 should be trivial
- 2.8
- Twig 2
- Internal refactoring
- Dropped PHP template Support
- Dropped support for ACLs
- Added a lot more support for marking units as depreciated
- more awesome more better
- PRs must pass Travis and appveyer
- appveyor like travis but with a windows box. WHAT WHAT!?!?!
- Deprecation Detector
- triggers E_USER_DEPRECATED from
@deprecated
annotations
- triggers E_USER_DEPRECATED from
- New in 3.0
- PSR 7
- Request and Response standard
- LDAP Component
- PSR 7
David Stockton @dstockto http://www.slideshare.net/dstockto/intermediate-oop-in-php-55282686
- magic methods are useful when useful
- polymorphism - Classes to follow, inherit, extend an agreed upon standard
- cohesion - do one thing, and do it well
- coupling - decouple all of the things
- Learning the SPL already. It's fucking awesome. Be more awesome
- Seriously
- __contruct()
- __destruct()
- Called when object goes out of scope
- __call()
- called when object calls inaccessible methods
- __callStatic()
- __get()
- called when reading a property that's not in scope
- $value = $bar->madeUpProperty;
- __set()
- called when a value is set to a property that doesn't exist on the instance on teh class
- __isset
- called when isset is called on a property on an object
- __unset
- Use cases
- with a magic setter:
- Can create a class that doesn't allow dynamically adding properties
- Can enforce a naming convention for dynamically set properties
- with a magic setter:
- Use cases
- __Sleep & __Wakeup
- Called on serialize() and unserialize()
- __sleep() to close connections, to clean up
- __wakeup use to reestablish connections
- somethings aren't serializable in PHP: closures
- __toString()
- retrieve a string representation of object
- __clone()
- by default clone is shallow
- Will duplicate scalar primary types, but not objects
- Uses the same instance of objects
- Will duplicate scalar primary types, but not objects
- by default clone is shallow
- __invoke()
- allows an object to be used like a function. (makes it callable)
- __autoload()
- Don't use __autoload instead use spl_autoload_register
- debuginfo()
- new in php 5.6
- controls output in var_dump()
Something somthing rectangles and squares
- Interfaces
- Abstract Classes
- subject communicate state changes to dependencies (observers)
- Allows for loose coupling of objects
- Dependencies can get passed as parameters to classes to create new objects that have instances of other objects
- "If you have to use the word 'And' when describing a method, class, or package, then it's probably doing to much."
- Inheritance is not the only way to extend functionality of a class
- Allow other classes to do work and communicate results
- Delicate work
HTTP Message Interface
- Sets standards for Request and Response objects
- Accepted May 18 2015
- Immutable request objects
- Reusable web layer b/n frameworks
- stackphp.com
- 7 Interfaces
- Stream
- Message
- Request
- Response
- ...
- Supported frameworks
- Slim 3
- Zend Expressive
- zend micro-framework
- radar
- Using PSR-7 and ADR pattern
- Nimble Framework
Taylor Otwell @taylorotwell
- Superpower Syntax
- empower your users, make people's lives easier
- Be opinionated
- laravel elixir is gulp as a service
- api code is like user experience
- Travel light
- less code is more better
- "Kent Beck Design rules"
- Iteration is a thing. dont over architect problems you don't have yet
- Traveling light is easier to document
- Scratch the itches
- Build anything
- It's better than the 95% that don't post anything
- Laravel homestead - vagrant packaged box
- don't try to be all things to all people
- Make your community positive and passionate
Kalpana Goel @kalpanagoel
-
Slides - bit.ly/debugging-d8
-
uncomment debug line in settings.php
$config['system.logging']['error_level'] = 'verbose';
-
Sweet lord settings.php ships with commented out code for a local.settings.php
-
Settings directive for many dealing with caching
-
Twig debug
- have to enable debugging in Twig
- Enables {{dump()}}
- Enables autoreload
- Can print loaded template files
-
Twig cache
- Don't touch it
- - Scott, twig maintainer
-
new stuff from devel
- kint($vars);
- king_trace();
- web-profile module
- Based on the profile component from symfony
- Timeline module
- How long the symfony components took to process a request
- Request info
- Shows configured routes
- All the things
- Bitchin'
-
Console
- scaffolding
- some debugging
-
profiling
- xhprof
- blackfire
-
container.debug
Sebastian Bergmann @s_bergmann
- 2 month release cycle
- Latest is phpUnit 5.x
- backwards compatability breaks b/c of PHP 7
- Dropped some support for some unused assertions
- assertSelectCount()
- small tests
@small
annotation- No longer allowed to touch I/O
- throws risky PHPUnit Exception
- teamcity logger (for phpstorm)
- Helps phpstorm continue to be able to communicate with new releases of PHPUnit
- Has been a problem in the past
- Helps phpstorm continue to be able to communicate with new releases of PHPUnit
- Can implement PHPUnit warnings
- Now marks testing mock objects as a risky and useless tests
- Mocks are only used to test other units
- Coming in the future: The project is going to separate the project into the test framework and a test runner
- PHP 7
- built in support for support for code coverage
- Utilizes phpdbg (with --qrr)
- Tests run a shit ton faster. Tests run up 5x faster.
- built in support for support for code coverage
Chris Tankersley @dragonmantank
- traditional web apps in php are heavy on processing on the server side
- single page returns html, then makes additional requests for data that calls php, server returns JSON like data
- caveats
- SEO sucks
- ad blocks may break site
- your host might not support it
- analytics become hard
- create SPA if
- you want a desktop like experience
- e.g. gmail
- you want a desktop like experience
- things of SPA
- Controller
- Templating
- Routing
- Drupal 8 API
- enable modules
- HAL
- HTTP Basic Auth
- use https
- RESTful Web Services
- Serialization
- set permissions for enabled modules
- REST UI
- Build routes through the UI
- Set accept types
- JSON, HAL JSON
- HAL JSON gives additional context
- enable modules
- Phil Sturgeons book "Build APIs you won't hate" is great
Anthony Ferrara @ircmaxell
- PHP is:
- forgiving
- Empowering
- Not opinionated
- PHP pillars
- Platform
- PHP is driven by contributors
- 7.1 wishlist
- Async support
- lambdas
- JIT?
- full autoloading
- annotations
- The HHVM project is good for competition
- It's driven PHP 7 and helping driving HHVM forward
- Ecosystem
- All the projects using PHP
- PHP is here to support ecosytem
- Can write OOP or not OOP
- PHP supports both
- PHP thrives with the ecosystem comes Together
- PHP-FIG
- gophp5
- Community
- individual communities aren't a sub set of PHP community, they over lap with PHP
- e.g. Some people identify as PHP community, some as WordPress community, some as both. And that's all awesome
- individual communities aren't a sub set of PHP community, they over lap with PHP
ToxicityIndividuality- projecting insecurities on others
- Assume someone has something positive to contribute even if they don't know they have anything to contribute
- Be different and come together
- Platform