Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
Is it feasible to code RevCMS style to be PDO?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="omatamix" data-source="post: 473059" data-attributes="member: 84722"><p>To get started with composer simply go to <a href="https://getcomposer.org/" target="_blank">https://getcomposer.org/</a>. Then click [ICODE]Download[/ICODE] and find [ICODE]Download and run Composer-Setup.exe - it will install the latest composer version whenever it is executed.[/ICODE] Then click [ICODE]Composer-Setup.exe[/ICODE]. That will go through the installation process on your computer. Do not click developer mode, just click next. Then select you php engine from your xampp directory. For example, [ICODE]C:\xampp\php\php.exe[/ICODE]. Then click next. Skip the proxy settings. And then finally click [ICODE]install[/ICODE] and after it finishes click [ICODE]finish[/ICODE]. Then open a new command prompt. Then navigate to your xampp htdocs folder. You can use commands like [ICODE]cd ../[/ICODE] to go back on directory or [ICODE]cd xampp[/ICODE] to navigate to a folder. Then just type [ICODE]composer[/ICODE] and hit enter. [ATTACH=full]13193[/ATTACH]</p><p>You should get something similar to above. Then in that same directory type [ICODE]composer require paragonie/easydb:^2[/ICODE] and hit enter, that will install EasyDB. Once it has finished composer will generate a [ICODE]composer.json[/ICODE] and a [ICODE]composer.lock[/ICODE] in your htdocs folder and a vendor folder to contain the code you just installed. Then you can access the code doing this.</p><p>[CODE=php]<?php declare(strict_types=1);</p><p></p><p>require __DIR__ . '/vendor/autoload.php';</p><p></p><p>// Then you can now use EasyDB.</p><p></p><p>$db = \ParagonIE\EasyDB\Factory::fromArray([</p><p> 'mysql:host=localhost;dbname=something',</p><p> 'username',</p><p> 'putastrongpasswordhere'</p><p>]);</p><p></p><p>$rows = $db->run('SELECT * FROM comments WHERE blogpostid = ? ORDER BY created ASC', $_GET['blogpostid']);</p><p>foreach ($rows as $row) {</p><p> $template_engine->render('comment', $row);</p><p>}</p><p>?>[/CODE]</p><p>Composer can be used to install useful packages from other developers so you don't have to reinvent the wheel when building your web application. Composer has more stuff you can do, read their documentation <a href="https://getcomposer.org/doc/01-basic-usage.md" target="_blank">https://getcomposer.org/doc/01-basic-usage.md</a>.</p><p>[automerge]1644087394[/automerge]</p><p>Also note some packages will require you to use a higher PHP version so if the package requires at least PHP 8 and you have PHP 7 composer will generate an error message. You can also learn more about the CLI commands here <a href="https://getcomposer.org/doc/03-cli.md" target="_blank">https://getcomposer.org/doc/03-cli.md</a>.</p></blockquote><p></p>
[QUOTE="omatamix, post: 473059, member: 84722"] To get started with composer simply go to [URL]https://getcomposer.org/[/URL]. Then click [ICODE]Download[/ICODE] and find [ICODE]Download and run Composer-Setup.exe - it will install the latest composer version whenever it is executed.[/ICODE] Then click [ICODE]Composer-Setup.exe[/ICODE]. That will go through the installation process on your computer. Do not click developer mode, just click next. Then select you php engine from your xampp directory. For example, [ICODE]C:\xampp\php\php.exe[/ICODE]. Then click next. Skip the proxy settings. And then finally click [ICODE]install[/ICODE] and after it finishes click [ICODE]finish[/ICODE]. Then open a new command prompt. Then navigate to your xampp htdocs folder. You can use commands like [ICODE]cd ../[/ICODE] to go back on directory or [ICODE]cd xampp[/ICODE] to navigate to a folder. Then just type [ICODE]composer[/ICODE] and hit enter. [ATTACH type="full" alt="composerHelp.PNG"]13193[/ATTACH] You should get something similar to above. Then in that same directory type [ICODE]composer require paragonie/easydb:^2[/ICODE] and hit enter, that will install EasyDB. Once it has finished composer will generate a [ICODE]composer.json[/ICODE] and a [ICODE]composer.lock[/ICODE] in your htdocs folder and a vendor folder to contain the code you just installed. Then you can access the code doing this. [CODE=php]<?php declare(strict_types=1); require __DIR__ . '/vendor/autoload.php'; // Then you can now use EasyDB. $db = \ParagonIE\EasyDB\Factory::fromArray([ 'mysql:host=localhost;dbname=something', 'username', 'putastrongpasswordhere' ]); $rows = $db->run('SELECT * FROM comments WHERE blogpostid = ? ORDER BY created ASC', $_GET['blogpostid']); foreach ($rows as $row) { $template_engine->render('comment', $row); } ?>[/CODE] Composer can be used to install useful packages from other developers so you don't have to reinvent the wheel when building your web application. Composer has more stuff you can do, read their documentation [URL]https://getcomposer.org/doc/01-basic-usage.md[/URL]. [automerge]1644087394[/automerge] Also note some packages will require you to use a higher PHP version so if the package requires at least PHP 8 and you have PHP 7 composer will generate an error message. You can also learn more about the CLI commands here [URL]https://getcomposer.org/doc/03-cli.md[/URL]. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
Is it feasible to code RevCMS style to be PDO?
Top