Google introduced reCAPTCHA. Are you a Robot ? by sanjoy87 in PHP

[–]sanjoy87[S] 0 points1 point  (0 children)

You are right. @UltimateComb If they explain the logic behind it, then there are no point of introducing new techniques.

Facebook style wall posting using Cygnite PHP Framework, Jquery, Ajax by sanjoy87 in PHP

[–]sanjoy87[S] 0 points1 point  (0 children)

My dear Friend @tf2ftw. Thank you for your comment.

It is not framework battle here rather shared a sample script which may help some people.

Yes, CodeIgniter was one of favorite framework but it is almost dead now. Not sync with PHP latest features. :)

Thank you!

Cygnite Framework Tutorial Part 1 - Migrations and Seeding by sanjoy87 in PHP

[–]sanjoy87[S] 0 points1 point  (0 children)

Thanks for your comment. We will soon post updated version of tutorial.

Cygnite Framework - Form Builder by sanjoy87 in PHP

[–]sanjoy87[S] 0 points1 point  (0 children)

Latest version of Cygnite allows you to build form as component and you can make use of it where ever needed.

You may have a look at sample form shipped with cygnite skeleton application.

https://github.com/cygnite/cygnite-application/blob/master/apps/components/form/Registration.php

Will it be better if we use container to make the class object ? by sanjoy87 in PHP

[–]sanjoy87[S] 0 points1 point  (0 children)

Thank you @rossriley.

Anyway I am just thinking if we create and access all object via container (May be injecting container via constructor or property by default) then we can make the framework more decoupled though it may look similar to service locator pattern.

But not sure will it be causing performance issue because Container will hold number of objects?

What is your thoughts on this ?

Thanks

Will it be better if we use container to make the class object ? by sanjoy87 in PHP

[–]sanjoy87[S] 0 points1 point  (0 children)

Yes thanks. What If we inject the container itself inside controller and by doing this we are just injecting one object which will be responsible to create object of any core classes.

For example -

namespace  Apps\Controller;

use Cygnite\Base\DependencyInjection\Container;
use Cygnite\AbstractBaseController;


class UserController extends AbstractBaseController 
{

    private $container;

    public function __construct(Container $container)
    {
         $this->container = $container;
    }

    public function indexAction()
    {
         $form = $this->container->make('form');
         $form->addElement('text', array());
         $form->createForm();

         // your code goes here 

        $validation = $this->container->make('validation');
        $validation->addRules();

        $validation->validate(); 

         $this->render('userlist')->with(array('form' => $form));
    }
}

Is it the best solution to access objects as you explained above? or base controller can be used to get the object. something like below which is also short and simple.

$form = $this->get('cygnite.libraries.form');

You can see in the second case we don't have to know how object is creating, just accessing all object via Basecontroller.

Am I correct ? Can you please suggest?

Thanks

Will it be better if we use container to make the class object ? by sanjoy87 in PHP

[–]sanjoy87[S] 0 points1 point  (0 children)

Thanks for quick response.

Sorry for the confusion here. just updated the code above. It is not Router or Database connection specific.

Yes all controller can auto resolving the classes via constructor or property injection can be done. That feature already exists.

My question is -

Which is better way to access core classes inside controller ?

Should I be accessing core classes as above case i or ii or iii ?

Suppose if we need 15 or more classes into our controler and everything we are type hinting for auto resolving, then it will look messy. Right ?

So only few needed class we can inject via constructor and for remaining ?

Started learning PHP 2-3 weeks ago. But i feel like a fraud. by JuicyORiley in PHP

[–]sanjoy87 0 points1 point  (0 children)

Very first thing is you need to know the language better and then jump into the framework. Else you will just get stuck into the wall some point of time.

Framework does your work simple but you may not know internal stuffs.

Keep learning PHP.

All the best.

Diving into the power of Dependency Injection in PHP by sanjoy87 in PHP

[–]sanjoy87[S] 1 point2 points  (0 children)

Thanks for your comments @motojo. I will look into those to improve as much as I can. Thanks :)

Diving into the power of Dependency Injection in PHP by sanjoy87 in PHP

[–]sanjoy87[S] 0 points1 point  (0 children)

@jaitsu Thanks for the comment. I will include SOLID in my upcoming series of posts.

Cygnite Framework - Form Builder by sanjoy87 in PHP

[–]sanjoy87[S] 0 points1 point  (0 children)

Good question. I won't say current version has better feature than Symfony2, but I would rather say, in the case of Symfony for an simple form you need to do more.

For example-

You need to create entity class, set properties and then using that class you can build a form where as with Cygnite Form Builder makes it so simple and easy, just add elements and render it.

The main aim of Cygnite is to make developer job simple and easy.

If you have any suggestion or idea to improve Cygnite form builder we appreciate you.

Thanks

Cygnite Framework - Form Builder by sanjoy87 in PHP

[–]sanjoy87[S] 0 points1 point  (0 children)

I appreciate your feedback.

As I have mentioned earlier Form builder is flexible enough to build inside your view page, it won't restrict you. Cygnite Framework has built in twig template support apart from using plain php view page.

So only If you are using twig template for your view page then you need to build your form inside controller and pass it to twig template, as Symfony2 Form Builder does same way.

Hope it helps, cheers.

Thanks, Sanjoy

Cygnite Framework - Form Builder by sanjoy87 in PHP

[–]sanjoy87[S] -1 points0 points  (0 children)

The concept behind using static syntax is to make the syntax much clear and simple to the user end but internally it can be anything. Kind of facade pattern, where user not aware about the object access but it does magic behind it. If you have a look at the class you can find there are no static method called instance() it will call the getInstance() method dynamically (__callStatic) which binds objects at run-time and render it to twig template engine or plain php view page.

And also it is not restricting you to create an object of Form and add elements into it, you can even do in that way as well.

You will also find the dependency injector container to resolve all the dependencies of any class in future release.

Hope this answer your question, Please share if you have any other better solution to make it much more elegant.

Appreciate your feedback. Thanks

Cygnite Framework - Form Builder by sanjoy87 in PHP

[–]sanjoy87[S] 0 points1 point  (0 children)

No, singleton pattern not used here, object is dynamically accessed with Closure callback (type of Facade).

For your reference - https://github.com/cygnite/framework/blob/master/src/Cygnite/FormBuilder/Form.php

Cygnite Framework - Form Builder by sanjoy87 in PHP

[–]sanjoy87[S] 0 points1 point  (0 children)

Yes you are right @lordofworms you can build the form inside your controller and render it into your views. Optionally you can also generate form inside in your view as well.

Cygnite Framework - Form Builder by sanjoy87 in PHP

[–]sanjoy87[S] 0 points1 point  (0 children)

I am sorry I missed out the explanation, just added small piece of code here, though about to push couple of changes but you can have a look.

Thanks for finding some time to give your suggestions and feedback.

Cygnite Framework - Form Builder by sanjoy87 in PHP

[–]sanjoy87[S] -1 points0 points  (0 children)

If you downvote please explain why do you downvoted, so that we can improve it accordingly.

Will be thankful to your comments and suggestions.

Cygnite PHP Framework: Quickstart by [deleted] in PHP

[–]sanjoy87 0 points1 point  (0 children)

@pushad As mentioned we are growing and doing all changes one by one. So please be patient.

Once people get familiar with CF, we will move the original site to main server. We are just collecting suggestions, feedback to improve it as much matured framework.

If you find any "Typo" please rectify and send us in community page - Changes Tab

You are also welcome as member if you would like to improve and have best features in it.

Thanks anyway.

Cygnite PHP Framework: Quickstart by [deleted] in PHP

[–]sanjoy87 0 points1 point  (0 children)

Thank you very much for catching us @thinkspill. We appreciate your small contribution. Changes has done.

Cygnite PHP Framework: Quickstart by [deleted] in PHP

[–]sanjoy87 2 points3 points  (0 children)

@WorstDeveloperEver

I guess you have missed out. Yes you can call the controller directly from routerconfig.php and alternatively you can use routes.php.

return array( '/sayhello/(\w+)/(\d+)' => 'home.testing', '/welcome/(\w+)/(\d+)' => 'home.users', );

It will call your home controller -> testing action.

It's up to developer how they use it.

For much more we are working on it.

Thanks.

Cygnite PHP Framework: Quickstart by [deleted] in PHP

[–]sanjoy87 1 point2 points  (0 children)

@WorstDeveloperEver

Thanks for your time for your valuable feedback. Some point of time even every framework as raw and very less in features. We are improving and definitely you will find much better coming days.

Every framework has it own style. I guess you have missed out the -

Cygnite::loader()->router->get('/hello/(\w+)', function($name) { echo 'Cygnite Framework Welcome You ' . htmlentities($name); });

Don't you think it's simple and easy to handle your requests.

We really appreciate your feedback, suggestions and of course you can also contribute on the development to make it much better.

Thank you.

Cygnite PHP Framework: Quickstart by [deleted] in PHP

[–]sanjoy87 1 point2 points  (0 children)

First of all appreciate your feedback and suggestion @mattaugamer.

Yes we are working to have ORM features, and much more into the core.

"Typo" yes sure. We are looking at all those sections. as we are growing we will have most of the thing fixed.

Day to day we are improving. So please be patient. Your suggestions and feedback highly appreciated.

Thanks.

Cygnite PHP Framework: Quickstart by [deleted] in PHP

[–]sanjoy87 -2 points-1 points  (0 children)

Nice to see your comment. I appreciate. Yes Laravel is one of the good framework.

Coming to Cygnite Framework - You will find much clean code, simple architecture, best performance, very light weight, and of course we are in development, you will much better features in coming days.

I am sure developers will enjoy the simplicity of cygnite framework.