Welcome Guest, Not a member yet? Register   Sign In
loading my own library into helper function


i have function form()
    # there is where i would like to load my library into $form_ variable
 $form_ = service('Form'); <- this doesn't work - my app/libraries/form library
 $timer = service('Timer'); <- this works - ci service


how can i load instance of ci into this helper function?

Second question: I created app/libraries/Form.php library

<?php namespace App\Libraries;

class Form
    protected $validation = false;

    public function __construct()
    $this->validation = [];

    public function validations()
    $this->validation['peter'] = 'test';
        return $this->validation;

    public function add($name,$rules)
    echo "OKa";
    $this->validation[$name] = $rules;


how can i load this library in my helper function form?

$validation = new Application\Libraries\Form;
when i try to call it like this, it does not work.

Theme © iAndrew 2016 - Forum software by © MyBB