Thread: Composer-izing

Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2008
    Location
    Edmonton, AB
    Posts
    61
    Plugin Contributions
    1

    Default Composer-izing

    Hi All,
    I was wondering if anyone uses Composer for things? I do plenty on other projects but it doesn't look like there's much support in Zencart. In trying to make life easier, I started dabbling in a composer-based solution to install/update Zencart but I've simply hit too many obstacles to continue without posting on the forum!

    * There are packages within Zencart that are not in the composer.json file!

    Since aura/autoload, ircmaxell/password-compat, square/connect, and PHPMailer/PHPMailer are in Zen Cart core couldn't they be added as Composer dependencies? They live in includes/classes/vendor but could be moved under Composer to live outside of the web root in a vendor/ folder managed by Composer. Thus not requiring developers to update those projects manually and subsequently the parent Zen Cart branch independently.

    Which would lead up to my other suggestion of having a "web root" within the project to serve files from. Currently it is the root of the project. Catering to Composer and adjusting for a "web root" things might look like this, with a web folder:

    Click image for larger version. 

Name:	composer1.PNG 
Views:	1161 
Size:	8.6 KB 
ID:	18891

    And then the web/ folder would be where you point your website root:

    Click image for larger version. 

Name:	composer-web.PNG 
Views:	1178 
Size:	12.5 KB 
ID:	18892


    This folder structure would probably be the first order of business in working toward a Composer plugin. But are there specific reasons why Composer support is minimal? Maybe something else is in the works? Would a composer plugin or composer branch be of any use to the community such that "composer create-project zencart" installs this format? (which would obviously require some core edits, eg. filepaths.php)



    On the future-future wishlist is plugins (for Composer and Zen Cart) such that this would be possible:
    Code:
    composer update
    Code:
    composer install zencart/usu
    Code:
    composer update zencart/edit_orders
    Since downloaded plugins don't have a common structure, this is a long way off. A ZC plugin can contain multiple folders of itself representing different tweaks for different versions of Zen Cart. And these folders can live in sub-folders of the author's choosing, like "common_files" or "zencart_files".

    Thoughts and comments welcome! Do you use/like/think Composer is worth it?

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,622
    Plugin Contributions
    123

    Default Re: Composer-izing

    > * There are packages within Zencart that are not in the composer.json file!
    Some work was done in this area in V2 but never moved back to the V1.5 branch. If you don't get any responses on this thread, you might want to open a Github issue and see if any developers respond there.

    https://github.com/zencart/zencart/issues
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Feb 2008
    Location
    Edmonton, AB
    Posts
    61
    Plugin Contributions
    1

    Default Re: Composer-izing

    Hmmm yeah I've never seen a v2 branch. Too bad because that's encouraging! I figured a post here would get the most eyeballs, and I didn't see any recent development-roadmap type posts (though I'm sure they exist somewhere [perhaps in someone's head!] so here would be the place to start)

    Since originally posting I realized that a composer plugin that could install and update plugins would be beyond sweet for so many reasons. Though it may introduce "a new way of doing things" to the point that if the Composer plugin supported patching (which it would) then highly customized Zen Carts could bank their custom patches to be re-applied after updates. Using Composer the usual install/upgrade path may not always require manually comparing files and updating applicable changes post-update with patches.

    Using Composer would be conducive for code novices looking to contribute (millenials? kidding not kidding). In general, to transform existing plugins from the Zen-cart.com website into something usable by Composer wouldn't require major code edits and could support multiple versions. A great way to get started!

    PS. Just throwing out ideas still at this point.

  4. #4
    Join Date
    Dec 2008
    Location
    Pittsburgh, PA
    Posts
    237
    Plugin Contributions
    1

    Default Re: Composer-izing

    Interested, came here after here: https://stackoverflow.com/questions/...-vendor-folder

  5. #5
    Join Date
    Dec 2008
    Location
    Pittsburgh, PA
    Posts
    237
    Plugin Contributions
    1

    Default Re: Composer-izing

    so... also confused. Doing a mod on zen 1.5.7, trying to bring in a UPC scanner with composer, and didn't want a public or guess-able vendors folder, so I moved it along side of public_html... but now I can't access anything like db table constants, functions_lookups.php etc.

    I tried including application_top.php but then it just white screen's w/ no errors.

    Any thoughts on this?

  6. #6
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: Composer-izing

    Quote Originally Posted by wolfderby View Post
    so... also confused. Doing a mod on zen 1.5.7, trying to bring in a UPC scanner with composer, and didn't want a public or guess-able vendors folder, so I moved it along side of public_html... but now I can't access anything like db table constants, functions_lookups.php etc.

    I tried including application_top.php but then it just white screen's w/ no errors.

    Any thoughts on this?
    Same result if you happened to temporarily use one of the built in paths? Say, white screens... not a 500 error? Theres a series of steps that can be taken to trouble shoot, which usually involves logging info to the logs folder. First would be to put one such entry just before and just after the call to includes/application_top.php. Would also suggest checking the server logs. It might be an error in the file that results in a php compile like error.

    Etc... etc... etc...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,669
    Plugin Contributions
    11

    Default Re: Composer-izing

    Quote Originally Posted by wolfderby View Post
    so... also confused. Doing a mod on zen 1.5.7, trying to bring in a UPC scanner with composer, and didn't want a public or guess-able vendors folder, so I moved it along side of public_html... but now I can't access anything like db table constants, functions_lookups.php etc.

    I tried including application_top.php but then it just white screen's w/ no errors.

    Any thoughts on this?
    learning ZC loading structure and the like.... hmmm....

    your stackoverflow post is good info; but trying to understand it with little experience.... well, it could be tough....

    a base ZC install is set to serve everything from DIR_FS_CATALOG. which generally is set to something like:

    /var/www/mysite/

    or

    /var/www/mysite/public_html/

    or whatever. it is defined in your configure.php file.

    now, if you want to use something OUTSIDE of that directory structure, a base ZC install is not really setup for that. i suppose one could set it up that way, but it gets tricky. ie making use of a file here:

    /var/www/mydirectory/

    one could very easily use files in a directory as such, and potentially set something up that way, but it is not how ZC is really meant to operate. this is despite the fact that plenty of other frameworks do operate that way.

    i am guessing that when you want to require the includes/application_top.php; you are in a file not found situation. as mc stated, your log files will point you to the problem. unfortunately, this is before any ZC log file overrides have taken place; and as such you need to look directly at the apache logs (assuming your server is running apache. if you are running nginx or something else to serve web pages, the logs from that program will have the answer). if you are in a shared hosting situation, my experience varies with getting those logs. but those logs will tell you all.

    if i am reading what you are attempting to do correctly, your code should more likely be:

    PHP Code:
    require_once('../mysite/includes/application_top'); 
    .. brings you up one level on the directory structure, so to use that file from another file outside of the DIR_FS_CATALOG, you need to get back to where DIR_FS_CATALOG is, and generally that means up... and then back down....

    as to why one wants to operate that way, you can research Security through obscurity which ZC is thoroughly based on. personally, i am not a fan, but that means little as the ZC core team (as well as any number of primary plugin contributors) have embraced it.

    https://en.wikipedia.org/wiki/Securi...ough_obscurity

    hope that helps!

    best.
    Last edited by carlwhat; 2 Nov 2021 at 04:05 AM.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

 

 

Similar Threads

  1. v150 any chance of a Visual Composer plugin for admin?
    By zenartman in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 16 Apr 2015, 07:12 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR