Download the PHP package drecon/confide without Composer

On this page you can find all versions of the php package drecon/confide. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package confide

Confide (Laravel4 Package)

Confide Poster

Build Status ProjectStatus

Confide is a authentication solution for Laravel4 made to eliminate repetitive tasks involving the management of users: Account creation, login, logout, confirmation by e-mail, password reset, etc.

Confide aims to be simple to use, quick to configure and flexible.

Note: If you are using MongoDB check Confide Mongo.

Features

Current:

If you are looking for user roles and permissions see Entrust

For MongoDB support see Confide Mongo

Planned:

Warning:

By default a confirmation email is sent and users are required to confirm the email address. It is easy to change this in the confide config file. Change signup_email and signup_confirm to false if you do not want to send them an email and they do not need to be confirmed to be able to login to the website.

Quick start

Required setup

In the require key of composer.json file add the following

"zizaco/confide": "3.2.x"

Run the Composer update comand

$ composer update

In your config/app.php add 'Zizaco\Confide\ConfideServiceProvider' to the end of the $providers array

'providers' => array(

    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Illuminate\Auth\AuthServiceProvider',
    ...
    'Zizaco\Confide\ConfideServiceProvider',

),

At the end of config/app.php add 'Confide' => 'Zizaco\Confide\ConfideFacade' to the $aliases array

'aliases' => array(

    'App'        => 'Illuminate\Support\Facades\App',
    'Artisan'    => 'Illuminate\Support\Facades\Artisan',
    ...
    'Confide'    => 'Zizaco\Confide\ConfideFacade',

),

Configuration

Set the properly values to the config/auth.php. This values will be used by confide to generate the database migration and to generate controllers and routes.

Set the address and name from the from array in config/mail.php. Those will be used to send account confirmation and password reset emails to the users.

User model

Now generate the Confide migration and the reminder password table migration:

$ php artisan confide:migration

It will generate the <timestamp>_confide_setup_users_table.php migration. You may now run it with the artisan migrate command:

$ php artisan migrate

It will setup a table containing email, password, confirmation_code and confirmed fields, which are the default fields needed for Confide use. Feel free to add more fields to the database.

Change your User model in app/models/User.php to:

This will allow you to update the current user.

Validate model fields

To change the validation rules of the User model you can take a look at Ardent. For example:

<?php

use Zizaco\Confide\ConfideUser;

class User extends ConfideUser {

    /**
     * Validation rules
     */
    public static $rules = array(
        'email' => 'required|email',
        'password' => 'required|between:4,11|confirmed',
    );

}

Feel free to add more fields to your table and to the validation array. Then you should build your own sign-up form with the additional fields.

NOTE: If you add fields to your validation rules into your model like above, do not forget you have to add those fields to the UserController store function also. If you forget this, the form will always return with an error. Example: $user->terms = Input::get('terms');

Passing additional information to the make methods

If you want to pass additional parameters to the forms, you can use an alternate syntax to achieve this.

Instead of using the make method:

Confide::makeResetPasswordForm( $token ):

You would use:

View::make(Config::get('confide::reset_password_form'))
    ->with('token', $token);

It produces the same output, but you would be able to add more inputs using 'with' just like any other view.

RESTful controller

If you want to generate a RESTful controller you can use the aditional --restful or -r option.

$ php artisan confide:controller --restful

Will result in a RESTful controller

Then, when dumping the routes, you should use the --restful option to match the existing controller.

$ php artisan confide:routes --restful

User roles and permissions

In order not to bloat Confide with not related features, the role and permission was developed as another package: Entrust. This package couples very well with Confide.

See Entrust

Redirecting to previous route after login

When defining your filter you should use the Redirect::guest('user/login') within your auth filter. For example:

// filters.php

Route::filter('auth', function()
{
    if ( Auth::guest() ) // If the user is not logged in
    {
        return Redirect::guest('user/login');
    }
});

// Only authenticated users will be able to access routes that begins with
// 'admin'. Ex: 'admin/posts', 'admin/categories'.
Route::when('admin*', 'auth'); 

or, if you are using Entrust ;)

// filters.php

Entrust::routeNeedsRole( 'admin*', 'Admin', function(){
        return Redirect::guest('user/login');
} );

Finally, it'll auto redirect if your controller's user/login function uses Redirect:intended('a/default/url/here') after a successful login. The generated controller does exactly this.

Validating a route

If you want to validate whether a route exists, the Confide::checkAction function is what you are looking for.

Currently it is used within the views to determine Non-RESTful vs RESTful routes.

Troubleshooting

__[Exception] SQLSTATE[HY000]: General error: 1364 Field 'confirmation_code' doesn't have a default value...__

If you overwrite the beforeSave() method in your model, make sure to call parent::beforeSave():

public function beforeSave( $forced = false ){

    parent::beforeSave( $forced) // Don't forget this

    // Your stuff
}

Confirmation link is not sent when user signup

Same as above. If you overwrite the afterSave() method in your model, make sure to call parent::afterSave():

Users are able to login without confirming account

If you want only confirmed users to login, in your UserController, instead of simply calling logAttempt( $input ), call logAttempt( $input, true ). The second parameter stands for _"confirmedonly".

Release Notes

Version 3.0.0

Updated to support Laravel 4.1

Version 2.0.0 Beta 4

Removed deprecated variable and functions.

Adds two config values

Version 2.0.0 Beta 3

Readme Update

Version 2.0.0 Beta 2

Pulls in a few pull requests and also locks to Ardent 2.1.x

Version 2.0.0 Beta 2

Locked to Ardent 1.1.x

Version 1.1.0

License

Confide is free software distributed under the terms of the MIT license

Aditional information

Any questions, feel free to contact me or ask here

Any issues, please report here


All versions of confide with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
illuminate/support Version ~4.1
laravelbook/ardent Version 2.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package drecon/confide contains the following files

Loading the files please wait ....