SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
THE STATE OF LITHIUM
li3_nyc::init() // 2012-02-07
SPONSORS
AGENDA
• State   of the framework

• New     features

• Upcoming     features

• Community         plugins

• Library   management & The Lab

• Tips   & tricks

• Q&A     / Demos!
STATE OF THE FRAMEWORK
PROJECT & COMMUNITY STATS

• ~130   plugin repositories on GitHub

• 350+   commits from 40+ contributors since 0.10

• 60+   commits to the manual since 0.10

• Closed   250+ issues since moving to GitHub

• 175   pull requests submitted since moving to GitHub
ROADMAP PROGRESS

• Cookie   signing / encryption

• CSRF    protection

• Error   Handling

• Manual   / automatic SQL result mapping

• Relationship   support
NEW FEATURES
ENCRYPT & SIGN COOKIES

Session::config(array('default' => array(
       'adapter' => 'Cookie',
       'strategies' => array(
           'Hmac' => array('secret' => '$f00bar$'),
           'Encrypt' => array('secret' => '$f00bar$')
       )
)));
NEST ROUTES
Router::connect("/admin/{:args}", array('admin' => true), array(
    'continue' => true
));

Router::connect("/{:locale:en|de|jp}/{:args}", array(), array(
    'continue' => true
));

Router::connect("/{:args}.{:type}", array(), array(
    'continue' => true
));
HANDLE ERRORS
$method = array(Connections::get('default'), 'read');

ErrorHandler::apply($method, array(), function($error, $params) {
    $queryParams = json_encode($params['query']);
    $msg = "Query error: {$error['message']}";

      Logger::warning("{$msg}, data: {$queryParams}");
      return new DocumentSet();
});
PROTECT FORMS
<?=$this->form->create(); ?>
    <?=$this->security->requestToken(); ?>
    <?=$this->form->field('title'); ?>
    <?=$this->form->submit('Submit'); ?>
<?=$this->form->end(); ?>


public function add() {
    if (
         $this->request->data &&
         !RequestToken::check($this->request)
    ) {
         // Badness!!
    }
}
UPCOMING FEATURES
HTTP SERVICE CLASSES
$http = new Http(array(
    ...
    'methods' => array(
        'do' => array('method' => 'post', 'path' => '/do')
    )
));
                                                POST /do HTTP/1.1
$response = $http->do(new Query(array(
                                                …
     'data' => array('title' => 'sup')
)));                                            title=sup
// var_dump($response->data());
FILTER / SORT COLLECTIONS

$users->find(array("type" => "author"))->sort("name");



$users->first(array("name" => "Nate"));
MULTIBYTE CLASS


• Supports   mbstring, intl, iconv & (womp, womp) plain PHP

• Only   one method right now: strlen()

• More   would be good… open a pull request
SCHEMA CLASS


• Arbitrary   data types

• Arbitrary   handlers

• Example: hash   modified passwords before writing

• Other   example: JSON en/decode arbitrary data for MySQL
PLUGINS
LI3_DOCTRINE2
                                Connections::add('default', array(
                                    'type' => 'Doctrine',
• Works   with Lithium stuff:       'driver' => 'pdo_mysql',
                                    'host' => 'localhost',
                                    'user' => 'root',
 • Connections                      'password' => 'password',
                                    'dbname' => 'my_db'
                                ));
 • Authentication               /**
                                 * @Entity
                                 * @Table(name="users")

 • Forms                         */
                                class User extends li3_doctrine2modelsBaseEntity {
                                    /**
                                     * @Id

 • Sessions                          * @GeneratedValue
                                     * @Column(type="integer")
                                     */
                                    private $id;

 • Validation                       /**
                                     * @Column(type="string",unique=true)
                                     */
                                    private $email;
                                    ...
                                }
LI3_FILESYSTEM
use li3_filesystemstorageFileSystem;

FileSystem::config(array(
    'default' => array(
        'adapter' => 'File'
    ),
    'ftp' => array(
        'adapter' => 'Stream',
        'wrapper' => 'ftp',
        'path' => 'user:password@example.com/pub/'
    }
));

FileSystem::write('default', '/path/to/file', $data);
LI3_ACCESS
Access::config(array(
    'asset' => array(
        'adapter' => 'Rules',
        'allowAny' => true,
        'default' => array('isPublic', 'isOwner', 'isParticipant'),
        'user'     => function() { return Accounts::current(); },
        'rules'    => array(
            'isPublic' => function($user, $asset, $options) {
                    ...
               },
               'isOwner' => function($user, $asset, $options) {
                    ...
               },
               'isParticipant' => function($user, $asset, $options) {
                    ...
               }
           )
     )
     ...
);
LI3_ACCESS
Access::config(array(
    ...
    'action' => array(
        'adapter' => 'Rules',
        'default' => array('isPublic', 'isAuthenticated'),
        'allowAny' => true,
        'user'      => function() { return Accounts::current(); },
        'rules'     => array(
            'isPublic' => function($user, $request, array $options) {
                ...
            },
            'isAuthenticated' => function($user, $request, array $options) {
                ...
            },
            'isAdmin' => function($user, $asset, $options) {
                ...
            }
        )
    )
);
LI3_ACCESS
Dispatcher::applyFilter('_call', function($self, $params, $chain) {
    $opts    = $params['params'];
    $request = $params['request'];
    $ctrl    = $params['callable'];

      if ($access = Access::check('action', null, $ctrl, $opts)) {
          // Reject
      }
      if ($access = Access::check('action', null, $ctrl, array('rules' => 'isAdmin') + $opts)) {
          // Reject
      }
      return $chain->next($self, $params, $chain);
});




class PostsController extends Base {

      public $publicActions = array('index', 'view');
}
http://bit.ly/li3plugins
THE LAB
TIPS & TRICKS
RETURN ON REDIRECT

class PostsController extends Base {

    public function view($post) {
        if (!$post) {
            $this->redirect("Posts::index");
        }
        // Herp derp
    }
}
FAT FILTERS == BAD
Dispatcher::applyFilter('run', function($self, $params, $chain) {
    // Herp
    // Derp
    // Herp
    // Derp
    // Herp
    // Derp
    // Herp
    // Derp
    // Herp
    // Derp
    // Herp
    (repeat x100)
});
DEFINE YOUR SCHEMA!

{
      count: 5,
      ...
}
...
{
      count: "5",
      ...
}
DON’T FEAR THE SUBCLASS
class Base extends lithiumdataModel {

    public function save($entity, $data = null, array $options = array()) {
        if ($data) {
            $entity->set($data);
        }
        if (!$entity->exists()) {
            $entity->created = new MongoDate();
        }
        $entity->updated = new MongoDate();
        return parent::save($entity, null, $options);
    }
}

class Posts extends Base {
    ...
}
QUICK & DIRTY ADMIN
Dispatcher::config(array('rules' => array(
     'admin' => array(
         'action' => 'admin_{:action}'
    )
)));
                                   class PostsController extends Base {
Router::connect(
                                      public function admin_index() {
    '/admin/{:args}',
                                          ...
    array('admin' => true),
                                      }
    array('continue' => true)
);
                                      public function index() {
                                          ...
                                      }
                                  }
Q&A / DEMOS
THANKS!

Weitere ähnliche Inhalte

Was ist angesagt?

Design Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et PimpleDesign Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et PimpleHugo Hamon
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistenceHugo Hamon
 
Database Design Patterns
Database Design PatternsDatabase Design Patterns
Database Design PatternsHugo Hamon
 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & RESTHugo Hamon
 
Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4Fabien Potencier
 
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)Fabien Potencier
 
Dependency Injection with PHP and PHP 5.3
Dependency Injection with PHP and PHP 5.3Dependency Injection with PHP and PHP 5.3
Dependency Injection with PHP and PHP 5.3Fabien Potencier
 
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010Fabien Potencier
 
Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)Fabien Potencier
 
Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Leonardo Proietti
 
Symfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il clienteSymfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il clienteLeonardo Proietti
 
New in cakephp3
New in cakephp3New in cakephp3
New in cakephp3markstory
 
Doctrine fixtures
Doctrine fixturesDoctrine fixtures
Doctrine fixturesBill Chang
 
PHP Data Objects
PHP Data ObjectsPHP Data Objects
PHP Data ObjectsWez Furlong
 
Future of HTTP in CakePHP
Future of HTTP in CakePHPFuture of HTTP in CakePHP
Future of HTTP in CakePHPmarkstory
 
SPL: The Missing Link in Development
SPL: The Missing Link in DevelopmentSPL: The Missing Link in Development
SPL: The Missing Link in Developmentjsmith92
 

Was ist angesagt? (20)

Design Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et PimpleDesign Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et Pimple
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistence
 
Database Design Patterns
Database Design PatternsDatabase Design Patterns
Database Design Patterns
 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & REST
 
Lithium Best
Lithium Best Lithium Best
Lithium Best
 
Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4
 
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
 
Dependency Injection with PHP and PHP 5.3
Dependency Injection with PHP and PHP 5.3Dependency Injection with PHP and PHP 5.3
Dependency Injection with PHP and PHP 5.3
 
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
 
Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)
 
Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5
 
Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3
 
Symfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il clienteSymfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il cliente
 
Agile database access with CakePHP 3
Agile database access with CakePHP 3Agile database access with CakePHP 3
Agile database access with CakePHP 3
 
New in cakephp3
New in cakephp3New in cakephp3
New in cakephp3
 
Doctrine fixtures
Doctrine fixturesDoctrine fixtures
Doctrine fixtures
 
PHP Data Objects
PHP Data ObjectsPHP Data Objects
PHP Data Objects
 
Future of HTTP in CakePHP
Future of HTTP in CakePHPFuture of HTTP in CakePHP
Future of HTTP in CakePHP
 
SPL: The Missing Link in Development
SPL: The Missing Link in DevelopmentSPL: The Missing Link in Development
SPL: The Missing Link in Development
 
CakeFest 2013 keynote
CakeFest 2013 keynoteCakeFest 2013 keynote
CakeFest 2013 keynote
 

Andere mochten auch

Measuring Your Code
Measuring Your CodeMeasuring Your Code
Measuring Your CodeNate Abele
 
Measuring Your Code 2.0
Measuring Your Code 2.0Measuring Your Code 2.0
Measuring Your Code 2.0Nate Abele
 
Introducing Zend Studio 10 Japanese Edition
Introducing Zend Studio 10 Japanese EditionIntroducing Zend Studio 10 Japanese Edition
Introducing Zend Studio 10 Japanese EditionSatoru Yoshida
 
Practical PHP 5.3
Practical PHP 5.3Practical PHP 5.3
Practical PHP 5.3Nate Abele
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDBNate Abele
 
PHP, Lithium and MongoDB
PHP, Lithium and MongoDBPHP, Lithium and MongoDB
PHP, Lithium and MongoDBMitch Pirtle
 
Taking PHP To the next level
Taking PHP To the next levelTaking PHP To the next level
Taking PHP To the next levelDavid Coallier
 
Lithium PHP Meetup 0210
Lithium PHP Meetup 0210Lithium PHP Meetup 0210
Lithium PHP Meetup 0210schreck84
 

Andere mochten auch (8)

Measuring Your Code
Measuring Your CodeMeasuring Your Code
Measuring Your Code
 
Measuring Your Code 2.0
Measuring Your Code 2.0Measuring Your Code 2.0
Measuring Your Code 2.0
 
Introducing Zend Studio 10 Japanese Edition
Introducing Zend Studio 10 Japanese EditionIntroducing Zend Studio 10 Japanese Edition
Introducing Zend Studio 10 Japanese Edition
 
Practical PHP 5.3
Practical PHP 5.3Practical PHP 5.3
Practical PHP 5.3
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDB
 
PHP, Lithium and MongoDB
PHP, Lithium and MongoDBPHP, Lithium and MongoDB
PHP, Lithium and MongoDB
 
Taking PHP To the next level
Taking PHP To the next levelTaking PHP To the next level
Taking PHP To the next level
 
Lithium PHP Meetup 0210
Lithium PHP Meetup 0210Lithium PHP Meetup 0210
Lithium PHP Meetup 0210
 

Ähnlich wie The State of Lithium

Dependency Injection
Dependency InjectionDependency Injection
Dependency InjectionRifat Nabi
 
DrupalCamp Foz - Novas APIs Drupal 7
DrupalCamp Foz - Novas APIs Drupal 7DrupalCamp Foz - Novas APIs Drupal 7
DrupalCamp Foz - Novas APIs Drupal 7chuvainc
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From IusethisMarcus Ramberg
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony TechniquesKris Wallsmith
 
laravel tricks in 50minutes
laravel tricks in 50minuteslaravel tricks in 50minutes
laravel tricks in 50minutesBarang CK
 
50 Laravel Tricks in 50 Minutes
50 Laravel Tricks in 50 Minutes50 Laravel Tricks in 50 Minutes
50 Laravel Tricks in 50 MinutesAzim Kurt
 
第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 DatasourceKaz Watanabe
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For BeginnersJonathan Wage
 
Digital Mayflower - Data Pilgrimage with the Drupal Migrate Module
Digital Mayflower - Data Pilgrimage with the Drupal Migrate ModuleDigital Mayflower - Data Pilgrimage with the Drupal Migrate Module
Digital Mayflower - Data Pilgrimage with the Drupal Migrate ModuleErich Beyrent
 
Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Jeff Carouth
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkJeremy Kendall
 
Open Source Search: An Analysis
Open Source Search: An AnalysisOpen Source Search: An Analysis
Open Source Search: An AnalysisJustin Finkelstein
 
Drush. Secrets come out.
Drush. Secrets come out.Drush. Secrets come out.
Drush. Secrets come out.Alex S
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ EtsyNishan Subedi
 
ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgnitermirahman
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsJarod Ferguson
 
Easy rest service using PHP reflection api
Easy rest service using PHP reflection apiEasy rest service using PHP reflection api
Easy rest service using PHP reflection apiMatthieu Aubry
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Shinya Ohyanagi
 
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011camp_drupal_ua
 

Ähnlich wie The State of Lithium (20)

Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
DrupalCamp Foz - Novas APIs Drupal 7
DrupalCamp Foz - Novas APIs Drupal 7DrupalCamp Foz - Novas APIs Drupal 7
DrupalCamp Foz - Novas APIs Drupal 7
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony Techniques
 
laravel tricks in 50minutes
laravel tricks in 50minuteslaravel tricks in 50minutes
laravel tricks in 50minutes
 
50 Laravel Tricks in 50 Minutes
50 Laravel Tricks in 50 Minutes50 Laravel Tricks in 50 Minutes
50 Laravel Tricks in 50 Minutes
 
第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource
 
Drupal7 dbtng
Drupal7  dbtngDrupal7  dbtng
Drupal7 dbtng
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
Digital Mayflower - Data Pilgrimage with the Drupal Migrate Module
Digital Mayflower - Data Pilgrimage with the Drupal Migrate ModuleDigital Mayflower - Data Pilgrimage with the Drupal Migrate Module
Digital Mayflower - Data Pilgrimage with the Drupal Migrate Module
 
Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro Framework
 
Open Source Search: An Analysis
Open Source Search: An AnalysisOpen Source Search: An Analysis
Open Source Search: An Analysis
 
Drush. Secrets come out.
Drush. Secrets come out.Drush. Secrets come out.
Drush. Secrets come out.
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 
ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgniter
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.js
 
Easy rest service using PHP reflection api
Easy rest service using PHP reflection apiEasy rest service using PHP reflection api
Easy rest service using PHP reflection api
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2
 
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
 

KĂźrzlich hochgeladen

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Christopher Logan Kennedy
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vĂĄzquez
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 

KĂźrzlich hochgeladen (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

The State of Lithium

  • 1. THE STATE OF LITHIUM li3_nyc::init() // 2012-02-07
  • 3. AGENDA • State of the framework • New features • Upcoming features • Community plugins • Library management & The Lab • Tips & tricks • Q&A / Demos!
  • 4. STATE OF THE FRAMEWORK
  • 5. PROJECT & COMMUNITY STATS • ~130 plugin repositories on GitHub • 350+ commits from 40+ contributors since 0.10 • 60+ commits to the manual since 0.10 • Closed 250+ issues since moving to GitHub • 175 pull requests submitted since moving to GitHub
  • 6. ROADMAP PROGRESS • Cookie signing / encryption • CSRF protection • Error Handling • Manual / automatic SQL result mapping • Relationship support
  • 8. ENCRYPT & SIGN COOKIES Session::config(array('default' => array( 'adapter' => 'Cookie', 'strategies' => array( 'Hmac' => array('secret' => '$f00bar$'), 'Encrypt' => array('secret' => '$f00bar$') ) )));
  • 9. NEST ROUTES Router::connect("/admin/{:args}", array('admin' => true), array( 'continue' => true )); Router::connect("/{:locale:en|de|jp}/{:args}", array(), array( 'continue' => true )); Router::connect("/{:args}.{:type}", array(), array( 'continue' => true ));
  • 10. HANDLE ERRORS $method = array(Connections::get('default'), 'read'); ErrorHandler::apply($method, array(), function($error, $params) { $queryParams = json_encode($params['query']); $msg = "Query error: {$error['message']}"; Logger::warning("{$msg}, data: {$queryParams}"); return new DocumentSet(); });
  • 11. PROTECT FORMS <?=$this->form->create(); ?> <?=$this->security->requestToken(); ?> <?=$this->form->field('title'); ?> <?=$this->form->submit('Submit'); ?> <?=$this->form->end(); ?> public function add() { if ( $this->request->data && !RequestToken::check($this->request) ) { // Badness!! } }
  • 13. HTTP SERVICE CLASSES $http = new Http(array( ... 'methods' => array( 'do' => array('method' => 'post', 'path' => '/do') ) )); POST /do HTTP/1.1 $response = $http->do(new Query(array( … 'data' => array('title' => 'sup') ))); title=sup // var_dump($response->data());
  • 14. FILTER / SORT COLLECTIONS $users->find(array("type" => "author"))->sort("name"); $users->first(array("name" => "Nate"));
  • 15. MULTIBYTE CLASS • Supports mbstring, intl, iconv & (womp, womp) plain PHP • Only one method right now: strlen() • More would be good… open a pull request
  • 16. SCHEMA CLASS • Arbitrary data types • Arbitrary handlers • Example: hash modied passwords before writing • Other example: JSON en/decode arbitrary data for MySQL
  • 18. LI3_DOCTRINE2 Connections::add('default', array( 'type' => 'Doctrine', • Works with Lithium stuff: 'driver' => 'pdo_mysql', 'host' => 'localhost', 'user' => 'root', • Connections 'password' => 'password', 'dbname' => 'my_db' )); • Authentication /** * @Entity * @Table(name="users") • Forms */ class User extends li3_doctrine2modelsBaseEntity { /** * @Id • Sessions * @GeneratedValue * @Column(type="integer") */ private $id; • Validation /** * @Column(type="string",unique=true) */ private $email; ... }
  • 19. LI3_FILESYSTEM use li3_filesystemstorageFileSystem; FileSystem::config(array( 'default' => array( 'adapter' => 'File' ), 'ftp' => array( 'adapter' => 'Stream', 'wrapper' => 'ftp', 'path' => 'user:password@example.com/pub/' } )); FileSystem::write('default', '/path/to/file', $data);
  • 20. LI3_ACCESS Access::config(array( 'asset' => array( 'adapter' => 'Rules', 'allowAny' => true, 'default' => array('isPublic', 'isOwner', 'isParticipant'), 'user' => function() { return Accounts::current(); }, 'rules' => array( 'isPublic' => function($user, $asset, $options) { ... }, 'isOwner' => function($user, $asset, $options) { ... }, 'isParticipant' => function($user, $asset, $options) { ... } ) ) ... );
  • 21. LI3_ACCESS Access::config(array( ... 'action' => array( 'adapter' => 'Rules', 'default' => array('isPublic', 'isAuthenticated'), 'allowAny' => true, 'user' => function() { return Accounts::current(); }, 'rules' => array( 'isPublic' => function($user, $request, array $options) { ... }, 'isAuthenticated' => function($user, $request, array $options) { ... }, 'isAdmin' => function($user, $asset, $options) { ... } ) ) );
  • 22. LI3_ACCESS Dispatcher::applyFilter('_call', function($self, $params, $chain) { $opts = $params['params']; $request = $params['request']; $ctrl = $params['callable']; if ($access = Access::check('action', null, $ctrl, $opts)) { // Reject } if ($access = Access::check('action', null, $ctrl, array('rules' => 'isAdmin') + $opts)) { // Reject } return $chain->next($self, $params, $chain); }); class PostsController extends Base { public $publicActions = array('index', 'view'); }
  • 26. RETURN ON REDIRECT class PostsController extends Base { public function view($post) { if (!$post) { $this->redirect("Posts::index"); } // Herp derp } }
  • 27. FAT FILTERS == BAD Dispatcher::applyFilter('run', function($self, $params, $chain) { // Herp // Derp // Herp // Derp // Herp // Derp // Herp // Derp // Herp // Derp // Herp (repeat x100) });
  • 28. DEFINE YOUR SCHEMA! { count: 5, ... } ... { count: "5", ... }
  • 29. DON’T FEAR THE SUBCLASS class Base extends lithiumdataModel { public function save($entity, $data = null, array $options = array()) { if ($data) { $entity->set($data); } if (!$entity->exists()) { $entity->created = new MongoDate(); } $entity->updated = new MongoDate(); return parent::save($entity, null, $options); } } class Posts extends Base { ... }
  • 30. QUICK & DIRTY ADMIN Dispatcher::config(array('rules' => array( 'admin' => array( 'action' => 'admin_{:action}' ) ))); class PostsController extends Base { Router::connect( public function admin_index() { '/admin/{:args}', ... array('admin' => true), } array('continue' => true) ); public function index() { ... } }