customize ZF2 ?

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

customize ZF2 ?

Mr User
This post has NOT been accepted by the mailing list yet.
Hello everyone

ok let's go strait to the point so i want to customize my ZF2 instalation but i couldn't find any kind of documentaion so let me tell you first what i did

i installed the ZendSkeletonApplication correctly and everything was good i was able to view the index page from my browser so i wanted to change the zf2 library location and i changed it to /usr/ZF2 after that i changed my httpd.conf by adding  SetEnv ZF2_PATH /usr/ZF2 and of course also my include_path in php.ini and i again i was able to view the index page so i said i should now remove vendor directory which i wanted in the first place one i did that nothing seem to work i opened the init_autoloader.php and guess what the probleme is in this 2 lines

if (file_exists('vendor/autoload.php')) {
    $loader = include 'vendor/autoload.php';
} ==> it was autoloading

i copied back my vendor directory so that i can study where do autoloading need this vendor directory and it seems that it does need it heir

// autoload_namespaces.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'Zend\\' => array($vendorDir . '/zendframework/zendframework/library'),
);


the probleme is whenever i try to change the array so that it will pont to my new library location the zf2 breakdown but when i channged back everything work

So now the questions ?

1-can someone plz explain to me why this is happening
2-can you plz tell me how to get ride of this vendor directory

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: customize ZF2 ?

Marco Pivetta


On 22 February 2014 21:32, Mr User [via Zend Framework Community] <[hidden email]> wrote:
Hello everyone

ok let's go strait to the point so i want to customize my ZF2 instalation but i couldn't find any kind of documentaion so let me tell you first what i did

What exactly do you mean by "customize my ZF2 instalation"? What is being changed?


i installed the ZendSkeletonApplication correctly and everything was good i was able to view the index page from my browser so i wanted to change the zf2 library location and i changed it to /usr/ZF2

You are not supposed to do that anymore. Global library installations is a bad idea in most cases - ZF2 allows you to do that, but you must have strong reasoning to actually apply that.
 
after that i changed my httpd.conf by adding  SetEnv ZF2_PATH /usr/ZF2 and of course also my include_path in php.ini and i again i was able to view the index page so i said i should now remove vendor directory which i wanted in the first place one i did that nothing seem to work i opened the init_autoloader.php and guess what the probleme is in this 2 lines

if (file_exists('vendor/autoload.php')) {
    $loader = include 'vendor/autoload.php';
} ==> it was autoloading

i copied back my vendor directory so that i can study where do autoloading need this vendor directory and it seems that it does need it heir

// autoload_namespaces.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'Zend\\' => array($vendorDir . '/zendframework/zendframework/library'),
);


the probleme is whenever i try to change the array so that it will pont to my new library location the zf2 breakdown but when i channged back everything work

That is normal, composer is not designed for global includes
 

So now the questions ?

1-can someone plz explain to me why this is happening

Composer installs dependencies per-project.
 
2-can you plz tell me how to get ride of this vendor directory


You shouldn't. I would help you on that only if I had an exact reasoning on why you are trying to do that.
Reply | Threaded
Open this post in threaded view
|

Re: customize ZF2 ?

Mr User
This post has NOT been accepted by the mailing list yet.
no reason at all i just heat this default instalation i would like to do things in my own way i hope that's a good reason for you
Reply | Threaded
Open this post in threaded view
|

Re: customize ZF2 ?

Marco Pivetta


On 23 February 2014 16:11, Mr User [via Zend Framework Community] <[hidden email]> wrote:
no reason at all i just heat this default instalation i would like to do things in my own way i hope that's a good reason for you

Nope, not good enough as a reason :-)

There's a motivation behind having per-repo packages, and that's maintainability, upgrades and security.

Why are you trying to move your repo to `/usr/`?
Reply | Threaded
Open this post in threaded view
|

Re: customize ZF2 ?

Stefano Torresi
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: customize ZF2 ?

Mr User
This post has NOT been accepted by the mailing list yet.
In reply to this post by Mr User
well as i said before there is  actually no raison at all it's just i wont it to be like that i don't even think that there will be some kind of security application because let's be honest to move a directoryto /usr only mean that you are the root of the system so i don't know what's are you trying to say but any way if you don't wont replay just say it no one will tell why ?

it's by fighting the freamwork that you will learn more
Reply | Threaded
Open this post in threaded view
|

Re: customize ZF2 ?

Marco Pivetta


On 23 February 2014 23:18, Mr User [via Zend Framework Community] <[hidden email]> wrote:
well as i said before there is  actually no raison at all it's just i wont it to be like that

That's how we used to code with PEAR dependencies, which were system-wide. It works, but it will bite you back.
 
i don't even think that there will be some kind of security application

The security implication is that multiple apps share the same codebase from `/usr`, and you may not be able to upgrade without upgrading all apps that reference it. If you have a security issue you should be able to upgrade ASAP ;-)
 
because let's be honest to move a directoryto /usr only mean that you are the root of the system

Yes, the problem is sharing the codebase across multiple installations.
 
so i don't know what's are you trying to say but any way if you don't wont replay just say it no one will tell why ?  

it's by fighting the freamwork that you will learn more

Agreed on that, I hope I made my point clear.

You can put ZF2 wherever you want as long as you export the "ZF2_PATH" var environment setting correctly - it just is almost never needed, if not harmful.

Cheers,
Reply | Threaded
Open this post in threaded view
|

Re: customize ZF2 ?

Mr User
This post has NOT been accepted by the mailing list yet.
In reply to this post by Mr User
first of all thank you for the info but any way even if you have a website you will not upgrade it each time it will be some how time consuming

well i tried what you saied but it dosn't work in fact i changed the autoload_namespaces.php so that i will point to the zend library but for some reason it dosn't work

Thank You
Reply | Threaded
Open this post in threaded view
|

Re: customize ZF2 ?

Marco Pivetta


On 24 February 2014 18:19, Mr User [via Zend Framework Community] <[hidden email]> wrote:
first of all thank you for the info but any way even if you have a website you will not upgrade it each time it will be some how time consuming


Yes, but we can't run away from that - parch releases are designed to handle that.
 
well i tried what you saied but it dosn't work in fact i changed the `autoload_namespaces.php` so that i will point to the zend library but for some reason it dosn't work


Well, if you use composer's autoloader, that one is going to be dictating that ZF2 comes from somewhere inside `vendor`. You can't really edit ANYTHING without `vendor`, since that's composer's domain (no touching!).

Instead, customize your `autoload_namespaces.php` by registering your own autoloader manually. You can just edit that file, no problems.

Marco Pivetta

http://twitter.com/Ocramius     

http://ocramius.github.com/
Reply | Threaded
Open this post in threaded view
|

Re: customize ZF2 ?

Mr User
This post has NOT been accepted by the mailing list yet.
In reply to this post by Mr User
well that's what i thought but when i do edit the file and make it like this

<?php

// autoload_namespaces.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

//return array(
//    'Zend\\' => array($vendorDir . '/zendframework/zendframework/library'),
//);


return array(
    'Zend\\' => array(getenv('ZF2_PATH')),
);


i loose everything even if the ZF2_PATH is registred in my path to the zend library i don't understand why ? i have read the source code of the files but i can't seem to know why the composer autoloader failed to charge the freamwork when i do change the zend library path



Reply | Threaded
Open this post in threaded view
|

Re: customize ZF2 ?

Marco Pivetta
Argh, sorry, my mistake.

I meant to tell you to customize init_autoloader.php ( https://github.com/zendframework/ZendSkeletonApplication/blob/2f60f8af002e6b7afc9f47a5e79e038e0baf5e3a/init_autoloader.php ), and instead I wrote "autoload_namespaces.php".

Do not edit ANYTHING within "vendor" ;-)



On 24 February 2014 19:09, Mr User [via Zend Framework Community] <[hidden email]> wrote:
well that's what i thought but when i do edit the file and make it like this

<?php

// autoload_namespaces.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

//return array(
//    'Zend\\' => array($vendorDir . '/zendframework/zendframework/library'),
//);


return array(
    'Zend\\' => array(getenv('ZF2_PATH')),
);


i loose everything even if the ZF2_PATH is registred in my path to the zend library i don't understand why ? i have read the source code of the files but i can't seem to know why the composer autoloader failed to charge the freamwork when i do change the zend library path






If you reply to this email, your message will be added to the discussion below:
http://zend-framework-community.634137.n4.nabble.com/customize-ZF2-tp4661729p4661740.html
To start a new topic under Zend Framework, email [hidden email]
To unsubscribe from Zend Framework Community, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: customize ZF2 ?

Mr User
This post has NOT been accepted by the mailing list yet.
In reply to this post by Mr User
that's the catch i wont to remove the vendor directory i find it some how messy

ok let's start again

i want in my /var/ directory to have things like this

config  data  composer init_autoloader.php module

and inside composer i just want these files

autoload.php  autoload_classmap.php  autoload_namespaces.php  autoload_psr4.php  autoload_real.php  ClassLoader.php


and my /var/www will be the public directory

and of course the zend library is in /usr/includes

but for some reason i wasn't able to do that
Reply | Threaded
Open this post in threaded view
|

Re: customize ZF2 ?

Marco Pivetta


On 24 February 2014 20:14, Mr User [via Zend Framework Community] <[hidden email]> wrote:
that's the catch i wont to remove the vendor directory i find it some how messy

You should get used to it, that's how "all the cool kids" are doing it nowadays...
 

ok let's start again

i want in my /var/ directory to have things like this

config  data  composer init_autoloader.php module

You want to rename "vendor" to "composer"? That's gonna break stuff for no reason. You can do that though: see https://getcomposer.org/doc/04-schema.md#config (vendor-dir)
 

and inside composer i just want these files

autoload.php  autoload_classmap.php  autoload_namespaces.php  autoload_psr4.php  autoload_real.php  ClassLoader.php

It will also contain the dependencies, not just those files...
 


and my /var/www will be the public directory

You should really use symlinks or vhosts instead of replacing /var/www directly
 

and of course the zend library is in /usr/includes

That is super-confusing :O
 

but for some reason i wasn't able to do that

Yeah, because the skeleton app is not meant to do that. It's still a skeleton app though, so you can manipulate it as it pleases you.


I still miss your point though - why is this being done? What's the rationale? The current structure comes from a lot
Reply | Threaded
Open this post in threaded view
|

Re: customize ZF2 ?

Mr User
This post has NOT been accepted by the mailing list yet.
In reply to this post by Mr User
no i don't want to rename vendor directory i want to remove it entirely and inside the composer directory it will only contain those files because here is how i see it first of all i downloaded the zf2 library from website then when i was doing the SkeletonApplication example i noticed that the vendor directory contain also the zf2 library at this point i had to remove one either the one that i alredy download or the one that the composer download it and because i wan't things different i choosed to remove the one included in the vendor directory and eventually all the directory

again i repeat i just wan't to do it you may think it's clean but i don't see it that way it's soooo messy for me