Create installation package for CakePHP 3.x

Hi, I have been working with a little project on my free time, you can find it at github, just look for Snorvarg/simplicity.
https://github.com/Snorvarg/simplicity

I am booting up the project again after some (too long) downtime.

Anyway, I would like to create an installation package so anyone can install it! The composer is not an alternative.

I installed composer and downloaded cakephp, so I have the files. My intention is to more or less zip it up, after merging in my files from simplicity. So anyone with access to a decent webhotel can unzip it in a folder and get started.

Anyone having any tips, big no-nos or experience of the same thing, please share with me!

check out

might be good for use before bin/cake is available =]

You can do it no problem.

On the other hand I would do it via composer :slight_smile:

Take a look at how Croogo does it (https://github.com/croogo/croogo/tree/3.0). You can also look at https://github.com/cakedc/oven for inspiration :slight_smile:

Thanks jlroberts, but I am not a fan of scripts, not a linux-person, no offense, sorry. :slight_smile:

Oven seem to be the way to go dakota! I tried to install it on my windows system, worked like a charm.

Will ask the guys making oven of course, but have you experience using it? Because after it install cake, I would like to install my own files and also create a few tables. Maybe I can just adapt their script?

Hi rrd,
I finally got time to work on this, and got a grip on how to use composer. :slight_smile:

Maybe I should put this as a new question on the forum, but I start with asking you: I am using the cake skeleton app, which nicely set up a fully working site for me. Then I can add my files.

But how do I do a composer script? Should I modify the composer.json file for the cake skeleton app?

Also, should I include all cake-php-files on github, or just my own files?

Again, thanks a lot!

Sure. If you need an extra package just add it to the required packages. Perhaps it is more safe to do it from the command line. Most of the packages’ docs desribe how to do it. Mainly it something like php composer.phar require vendor/package

The best if you have a .gitignore file like this:

/vendor/*
/config/app.php
/tmp/*
/logs/*
/webroot/.htaccess
.htaccess

These files should not go to version control and you can add any other if you want.

I am really confused about the way I should do this… I want a composer.json file anyone can use to install my project.

So I modify the composer.json after ‘checking out’ all the files of the cakephp/app project. That should work, but I lose the ability to get any fixes the team of the cakephp/app project will do… But I guess it is named a skeleton app for a reason: So I can build from it.

Argh, I will try it out again. :slight_smile: Thanks again rrd.

Hmm, what am I doing wrong here… I run the composer to download cakephp/app into a folder. Then I added my files to its various places and added them to git.
I modified the composer.json file so it points to my own repository. Then I created a “contribution”.
Finally I created a local composer.json looking like this:

{
  "require": {
    "madskullcreations/simplicity":"dev-master@dev"
  },
  "repositories": [
    {
       "type": "vcs",
       "url": "https://github.com/madskullcreations/simplicity" 
    }
  ]
}

and then I ran “composer install” in the same folder. Everything downloads fine with no errors.

But everything ends up in a vendor folder, and inside of that folder everything looks totally different from what it would look like if I would use the cakephp/app repo… Meaning what?!
…it is basically the same composer.json file, so why does it look totally different.

I get some odd folder structure with the folders aura, bin, cakephp, …, madskullcreations, … etc.

The expected folder structure should have been the well-known cakeish: bin, config, logs, plugins, src, tests, tmp, vendor, webroot.

Please, if you can, check it out here:

I tried to make a new release through packagist and install it with the same syntax as for cakephp/app, but of course the scripts post-install failed, some files defined in cakephp/app is still missing… Will try again after adding the missing files.

Someone should make a guide explaining how to create a package based on cakephp/app. :slight_smile:

Ah I see. Are you building a CakePHP plugin or a full CakePHP based package?

rrd, Now I believe I got the hang of it. I simply add most of the same files to my repository as they have done in cakephp/app.

…In the end, I will have a copy of the cakephp/app skeleton with my own files added.

The initial misunderstanding: I believed I could easily “require” the cakephp/app skeleton files in my own composer.json. But now I realize it is better to do a more or less full copy of the repository.

This should be clarified with an example in the cakephp/app docs. (although any beginner must do this journey/mess to get acquainted with composer.)

I build a full CakePHP based package. I realize it is not very common though. :slight_smile:

There are services build on CakePHP. But yes the skeleton is not something you require. You start with that, bake and modify and add new things. And you can end up with a full composer installable application.