Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

TutsPlus.com:
Using Illuminate Database With Eloquent in Your PHP App Without Laravel
Jan 26, 2017 @ 15:51:05

The TutsPlus.com site has posted a new tutorial showing you how you can use the Eloquent ORM from Laravel without having to use Laravel itself. There's already functionality built into the popular database interface that makes it possible, it's just a matter of turning it on.

Illuminate is Laravel’s database engine minus Laravel. It comes bundled with the Eloquent ORM in Laravel. If you would like to build your PHP apps with ORMs and prefer not to use Laravel, this tutorial is for you.

In this tutorial, we are going to build the back end for a Q&A App with PHP, Illuminate Database, and the Eloquent ORM.

They start the post with a list of requirements and a brief outline of what functionality the end result will include. With that defined the tutorial starts in on the directory structure of the application and the Composer configuration to pull in Eloquent and its requirements. Next up is the code to define the connection credentials and (raw) SQL to create the tables in the database. The database "capsule" is created and the code is shared to create simple controllers and matching models for users, questions, answers and upvotes. They show how to use relationships to get the linked objects between tables and how to perform update and delete operations.

tagged: illuminate database eloquent laravel outside tutorial capsule

Link: https://code.tutsplus.com/tutorials/using-illuminate-database-with-eloquent-in-your-php-app-without-laravel--cms-27247

Johannes Siipola:
How to use Eloquent ORM migrations outside Laravel
Jan 20, 2016 @ 17:55:10

On his site Johannes Siipola has posted a tutorial showing how to use the Eloquent ORM outside of Laravel, more specifically the migration functionality to manage database table creation/updates/deletions.

Laravel's Eloquent is one of the most fluent and expressive ORM's available for PHP. However, unlike some of its competitors like Doctrine or Propel, it's highly tight to the Laravel ecosystem in some ways. It's still possible to use Eloquent outside Laravel with a bit of work.

[...] If you use Eloquent outside Laravel, you will be missing one of it's best features: database migrations. [...] There has been some effort in order to use Laravel migrations outside the framework, but it hasn't been possible because the migrations require a complete instance of Laravel to run. In this tutorial, we are using framework agnostic Phinx migration library instead.

He then shows how to install the packages needed for the example: Slim framework, the Eloquent ORM and Phinx. He then shows how to set up the database and Phinx configurations and create your first Phinx migration. Inside this migration he makes use of the Eloquent schema builder functionality to create a simple "widgets" table. He ends the post showing you how to create the simple Slim application and work with the model they've created to both save and read data easily.

tagged: eloquent laravel outside orm migration phinx slimframework tutorial

Link: https://siipo.la/blog/how-to-use-eloquent-orm-migrations-outside-laravel

Leonid Mamchenkov's Blog:
Perl vs. PHP : variable scoping
Dec 12, 2008 @ 14:49:14

Leonid Mamchenkov has compared Perl versus PHP in this new blog post - specifically how they handle variable scoping.

I've mentioned quite a few times that I am a big fan of Perl programming language. However, most of my programming time these days is spent in PHP. The languages are often similar, with PHP having its roots in Perl, and Perl being such a influence in the world of programming languages. This similarity is often very helpful. However there are a few difference, some of which are obvious and others are not.

His example compares looping (a foreach in both) and how, after the Perl loop the $value variable is no longer accessible. In PHP, however, it's passed back out into the current scope and can be read just like any other variable. While this can be useful, it can also cause headaches when trying to track down elusive bugs.

tagged: variable scope foreach loop local outside compare

Link:

Melvin Rivera's Blog:
Approving comments outside WordPress
Nov 28, 2008 @ 15:43:22

Melvin Rivera has come up with a quick script that allows you approve comments outside of your WordPress installation:

The job of approving comments sometimes falls on a person who does/should not have access to the WordPress admin. By design WordPress only allows a user with admin privileges to do this job. I wrote an an External Web Interface for approving pending WordPress comments via XMLRPC.

You can download the source from the Google Code site for the project and check out a screencast in his blog post.

tagged: approve comment outside wordpress blog xmlrpc

Link:

Zend Developer Zone:
PHP Security Tip #19 (Securing Your Connection)
Mar 29, 2007 @ 17:36:00

The Zend Developer Zone has posted their latest security tip today - this time dealing with the actual connection your application sits on (from Chris Hartjes).

The most secure application is one with no connection to the outside world.

As we've covered, you can't really disconnect the network from your web server if you are building web applications. You can however, carefully consider which servers need to be connected to the outside world and which can be inside your firewall. Beyond that, you can also evaluate how those servers that have to remain outside your firewall communicate with the ones inside.

No, his suggestion is not to take your application "off the grip" but more to limit access to things like database servers to help protect the data that lives inside it.

tagged: securitytip application secure outside database firewall server securitytip application secure outside database firewall server

Link:

Zend Developer Zone:
PHP Security Tip #19 (Securing Your Connection)
Mar 29, 2007 @ 17:36:00

The Zend Developer Zone has posted their latest security tip today - this time dealing with the actual connection your application sits on (from Chris Hartjes).

The most secure application is one with no connection to the outside world.

As we've covered, you can't really disconnect the network from your web server if you are building web applications. You can however, carefully consider which servers need to be connected to the outside world and which can be inside your firewall. Beyond that, you can also evaluate how those servers that have to remain outside your firewall communicate with the ones inside.

No, his suggestion is not to take your application "off the grip" but more to limit access to things like database servers to help protect the data that lives inside it.

tagged: securitytip application secure outside database firewall server securitytip application secure outside database firewall server

Link:


Trending Topics: