psecio / gatekeeper

Gatekeeper: An Authentication & Authorization Library
366 stars 23 forks source link

documentation #50

Open the1gofer opened 8 years ago

the1gofer commented 8 years ago

I'm a little bit confused about the documentation. Granted, I am not an advanced programer, I am somewhere in advanced beginner to intermediate.

First, I don't have access to composer on my hosting, so I downloaded the repository and uploded the SRC folder to my project, so apparently the whole quick setup isn't going to work for me. I couldn't find the in the repo anywhere.

I do see that I can configure it manually using

<?php
require_once 'vendor/autoload.php';
use \Psecio\Gatekeeper\Gatekeeper;

Gatekeeper::init();
?>

and

<?php
// You can specify your own .env path
Gatekeeper::init('/path/to/directory');

// You can also force the use of your own database configuration
$config = array(
    'type' => 'mysql',
    'username' => 'gatekeeper-user',
    'password' => 'gatekeeper-pass',
    'name' => 'gatekeeper',
    'host' => 'gatekeeper-db.localhost'
);
Gatekeeper::init(null, $config);
?>

does this mean for every script I need to start with this code?

I see it says "You can pass in options to the init call if you don't necesarily want to use the .env configuration file handling." but their are no ENV files for me to configure.

What am I missing?

smolinari commented 8 years ago

does this mean for every script I need to start with this code?

I would say, yes.

but their are no ENV files for me to configure.

The docs note that gatekeeper uses the phpdotenv library.

https://github.com/vlucas/phpdotenv

There is also a ".env.dist" file in the root of the repo, which seems to be an example file. In that file, you'll find example database configuration variables. You could remove the ".dist" and you have a ".env" file.

For development work, as you've indicated, using a shared host webspace isn't the best alternative. You should think about using Virtual Box and Vagrant to do development work a locally built VM. Here is an article on how to go about it.

http://www.sitepoint.com/getting-started-vagrant-windows/

You can also set up a specialized Vagrant box with Puphpet. https://puphpet.com/

Have fun! :smile:

Scott