<commit_before><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Auth &mdash; Fuel Hybrid Documentation</title>
    <link href="../assets/css/main.css" media="screen" rel="stylesheet" />
    <script type="text/javascript" src="../assets/js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="../assets/js/nav.js"></script>
    <script type="text/javascript" src="../assets/js/highlight.pack.js"></script>
    <script type="text/javascript">
        $(function() {
            show_nav('auth', '../');
            hljs.tabReplace = '    ';
            hljs.initHighlightingOnLoad();
        });
    </script>

</head>
<body>

    <header>
        <h1>Fuel Hybrid Documentation</h1>
    </header>

    <div id="main-nav"></div>

    <section id="content">
        
        <h2 id="">Auth</h2>

        <p>
            The Auth classes provides a standardized interface for authentication in Fuel. This allows our users to write their own drivers and easily integrate a new driver to work with old code by keeping the basic methods consistent.
        </p>

        <h3>Configuration</h3>

        <p>
            Auth_Twitter can be configured in a <strong>config/app.php</strong> file and takes the following keys:
        </p>

         <table class="config">
            <tbody>
                <tr class="header">
                    <th>Param</th>
                    <th>Type</th>
                    <th>Default</th>
                    <th>Description</th>
                </tr>
                <tr>
                    <th>auth.use_twitter</th>
                    <td>string</td>
                    <td><pre class="php"><code class="php">false</code></pre></td>
                    <td>
                        Use twitter data source.
                    </td>
                </tr>
                <tr>
                    <th>api.twitter.consumer_key</th>
                    <td>string</td>
                    <td><pre class="php"><code class="php">''</code></pre></td>
                    <td>
                        Twitter Consumer Key.
                    </td>
                </tr>
                <tr>
                    <th>api.twitter.consumer_secret</th>
                    <td>string</td>
                    <td><pre class="php"><code class="php">''</code></pre></td>
                    <td>
                        Twitter Consumer Secret.
                    </td>
                </tr>
            </tbody>
        </table>

        <h2 id="how-to">How To</h2>
        <ol>
            <li>Create a controller at <strong>app/classes/controller/twitter.php</strong>.
                <pre class="php"><code>&lt;?php

class Controller_Twitter extends \Hybrid\Auth_Twitter_Controller {}</code></pre>
            </li>
            <li>Create a new application at <a href="http://devs.twitter.com/apps/new">Twitter Developer</a>.</li>
            <li>Set Callback URI to <strong>http://hostname/twitter/</strong> (change hostname to your Fuel Framework's web server configuration). </li>
            <li>Twitter API key can be configured in <strong>config/app.php</strong> file and takes the following keys:
                <pre class="php"><code>
    'auth'                  => array(

        // Auth to enable Twitter Oauth.
        'use_twitter'           => true,

    ),
    'api'                   => array(
        'twitter'               => array(
            'consumer_key'          => 'YOUR_CONSUMER_KEY',
            'consumer_secret'       => 'YOUR_CONSUMER_SECRET',
        ),
    ),</code></pre>
            </li>
            <li>Create a login button and you're ready to go.
                <pre class="php"><code>&lt;?php echo \Hybrid\Html::anchor('twitter/login', 'Sign-in with Twitter'); ?></code></pre>
            </li>
        </ol>

        <p class="note">'php oil refine hybrid --install' can automatically generate your model and migration files, however use below for best practice.</p>

        <article>
            <h3>Suggested Models</h3>

        </article>

        <article>
            <h3>Suggested Migrations</h3>

        </article>

    </section>
    
    <section id="footer">
        <p>
            <a href="http://github.com/crynobone/fuel-hybrid">Fuel Hybrid Package</a> is released under the MIT license.<br />
            &copy; 2010 - 2011 <NAME>
        </p>
    </section>

</body>
</html><commit_msg>Add Model + Migration example for \Hybrid\Auth_Twitter<commit_after><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Auth &mdash; Fuel Hybrid Documentation</title>
    <link href="../assets/css/main.css" media="screen" rel="stylesheet" />
    <script type="text/javascript" src="../assets/js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="../assets/js/nav.js"></script>
    <script type="text/javascript" src="../assets/js/highlight.pack.js"></script>
    <script type="text/javascript">
        $(function() {
            show_nav('auth', '../');
            hljs.tabReplace = '    ';
            hljs.initHighlightingOnLoad();
        });
    </script>

</head>
<body>

    <header>
        <h1>Fuel Hybrid Documentation</h1>
    </header>

    <div id="main-nav"></div>

    <section id="content">
        
        <h2 id="">Auth</h2>

        <p>
            The Auth classes provides a standardized interface for authentication in Fuel. This allows our users to write their own drivers and easily integrate a new driver to work with old code by keeping the basic methods consistent.
        </p>

        <h3>Configuration</h3>

        <p>
            Auth_Twitter can be configured in a <strong>config/app.php</strong> file and takes the following keys:
        </p>

         <table class="config">
            <tbody>
                <tr class="header">
                    <th>Param</th>
                    <th>Type</th>
                    <th>Default</th>
                    <th>Description</th>
                </tr>
                <tr>
                    <th>auth.use_twitter</th>
                    <td>string</td>
                    <td><pre class="php"><code class="php">false</code></pre></td>
                    <td>
                        Use twitter data source.
                    </td>
                </tr>
                <tr>
                    <th>api.twitter.consumer_key</th>
                    <td>string</td>
                    <td><pre class="php"><code class="php">''</code></pre></td>
                    <td>
                        Twitter Consumer Key.
                    </td>
                </tr>
                <tr>
                    <th>api.twitter.consumer_secret</th>
                    <td>string</td>
                    <td><pre class="php"><code class="php">''</code></pre></td>
                    <td>
                        Twitter Consumer Secret.
                    </td>
                </tr>
            </tbody>
        </table>

        <h2 id="how-to">How To</h2>
        <ol>
            <li>Create a controller at <strong>app/classes/controller/twitter.php</strong>.
                <pre class="php"><code>&lt;?php

class Controller_Twitter extends \Hybrid\Auth_Twitter_Controller {}</code></pre>
            </li>
            <li>Create a new application at <a href="http://devs.twitter.com/apps/new">Twitter Developer</a>.</li>
            <li>Set Callback URI to <strong>http://hostname/twitter/</strong> (change hostname to your Fuel Framework's web server configuration). </li>
            <li>Twitter API key can be configured in <strong>config/app.php</strong> file and takes the following keys:
                <pre class="php"><code>
    'auth'                  => array(

        // Auth to enable Twitter Oauth.
        'use_twitter'           => true,

    ),
    'api'                   => array(
        'twitter'               => array(
            'consumer_key'          => 'YOUR_CONSUMER_KEY',
            'consumer_secret'       => 'YOUR_CONSUMER_SECRET',
        ),
    ),</code></pre>
            </li>
            <li>Create a login button and you're ready to go.
                <pre class="php"><code>&lt;?php echo \Hybrid\Html::anchor('twitter/login', 'Sign-in with Twitter'); ?></code></pre>
            </li>
        </ol>

        <p class="note">'php oil refine hybrid --install' can automatically generate your model and migration files, however use below for best practice.</p>

        <article>
            <h3>Suggested Models</h3>

            <h4>Model_Twitter</h4>

            <pre class="code"><code>&lt;?php

class Model_Twitter extends Orm\Model {
    
    protected static $_properties = array(
        'id',
        'twitter_name',
        'full_name',
        'profile_image',
    );

    protected static $_has_one = array(
        'users_twitters' => array(
            'model_to'      => 'Model_Users_Twitter',
        ),
    );

}</code></pre>

            <h4>Model_Users_Twitter</h4>

            <pre class="code"><code>&lt;?php

class Model_Users_Twitter extends Orm\Model {
    
    protected static $_properties = array(
        'id',
        'user_id',
        'twitter_id',
    );

    protected static $_belongs_to = array(
        'users'     => array(
            'model_to'  => 'Model_User',
        ),
        'twitters'  => array(
            'model_to'  => 'Model_Twitter',
        ),
    );

}</code></pre>

        </article>

        <article>
            <h3>Suggested Migrations</h3>

            <h4>Create_twitters</h4>

            <pre class="php"><code>&lt;?php

namespace Fuel\Migrations;

class Create_twitters {

    public function up()
    {
        \DBUtil::create_table('twitters', array(
            'id' => array('constraint' => 30, 'type' => 'bigint'),
            'twitter_name' => array('constraint' => 200, 'type' => 'varchar'),
            'full_name' => array('constraint' => 100, 'type' => 'varchar'),
            'profile_image' => array('constraint' => 255, 'type' => 'varchar'),
        ), array('id'));
    }

    public function down()
    {
        \DBUtil::drop_table('twitters');
    }
}</code></pre>

            <h4>Create_users_twitters</h4>

            <pre class="php"><code>&lt;?php

namespace Fuel\Migrations;

class Create_users_twitters {

    public function up()
    {
        \DBUtil::create_table('users_twitters', array(
            'id' => array('constraint' => 11, 'type' => 'int', 'auto_increment' => true),
            'user_id' => array('constraint' => 11, 'type' => 'int'),
            'twitter_id' => array('constraint' => 30, 'type' => 'bigint'),
        ), array('id'));
    }

    public function down()
    {
        \DBUtil::drop_table('users_twitters');
    }
}</code></pre>
        </article>

    </section>
    
    <section id="footer">
        <p>
            <a href="http://github.com/crynobone/fuel-hybrid">Fuel Hybrid Package</a> is released under the MIT license.<br />
            &copy; 2010 - 2011 <NAME>
        </p>
    </section>

</body>
</html>
{'fraction_non_alphanumeric': 0.1526530612244898, 'fraction_numerical': 0.0066213151927437645, 'mean_word_length': 1.6384302464704474, 'pattern_counts': {'":': 0, '<': 317, '<?xml version=': 0, '>': 359, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5500509', 'n_tokens_mistral': 3343, 'n_tokens_neox': 3107, 'n_words': 712}