PHP code example of ritalin / omelet

1. Go to this page and download the library: Download ritalin/omelet library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ritalin / omelet example snippets


    use \Omelet\Annotation\Select;
    
    interface TodoDao {
        /**
         * @Select
         */
        function listAll();
    }
    

    $config = \Omelet\Builder\Configuration;
    $config->connectionString = "driver=pdo_sqlite&path=/path/to/todo.sqlite3";
    
    $context = new \Omelet\Builder\DaoBuilderContext($config);
    

    $context->build(Todo::class);
    

    $conn = \Doctrine\DBAL\DriverManager->getConnection($context->connectionString());
    $dao = new TodoImpl($conn, $context);
    $rows = $dao->listAll();