Coder Social home page Coder Social logo

kenjis / codeigniter-composer-installer Goto Github PK

View Code? Open in Web Editor NEW
380.0 46.0 118.0 53 KB

Installs the offical CodeIgniter 3 with secure folder structure via Composer

License: MIT License

Shell 9.40% PHP 90.60%
codeigniter composer installer codeigniter3 hacktoberfest

codeigniter-composer-installer's Introduction

CodeIgniter Composer Installer

Latest Stable Version Total Downloads Latest Unstable Version License

This package installs the offical CodeIgniter (version 3.1.*) with secure folder structure via Composer.

You can update CodeIgniter system folder to latest version with one command.

Folder Structure

codeigniter/
├── application/
├── composer.json
├── composer.lock
├── public/
│   ├── .htaccess
│   └── index.php
└── vendor/
    └── codeigniter/
        └── framework/
            └── system/

Requirements

How to Use

Install CodeIgniter

$ composer create-project kenjis/codeigniter-composer-installer codeigniter

Above command installs public/.htaccess to remove index.php in your URL. If you don't need it, please remove it.

And it changes application/config/config.php:

$config['composer_autoload'] = FALSE;
↓
$config['composer_autoload'] = realpath(APPPATH . '../vendor/autoload.php');
$config['index_page'] = 'index.php';
↓
$config['index_page'] = '';

Install Translations for System Messages

If you want to install translations for system messages:

$ cd /path/to/codeigniter
$ php bin/install.php translations 3.1.0

Install Third Party Libraries

Codeigniter Matches CLI:

$ php bin/install.php matches-cli master

CodeIgniter HMVC Modules:

$ php bin/install.php hmvc-modules master

Modular Extensions - HMVC:

$ php bin/install.php modular-extensions-hmvc codeigniter-3.x

Ion Auth:

$ php bin/install.php ion-auth 2

CodeIgniter3 Filename Checker:

$ php bin/install.php filename-checker master

CodeIgniter Rest Server:

$ php bin/install.php restserver 2.7.2

CodeIgniter Developer Toolbar:

$ php bin/install.php codeigniter-develbar master

Run PHP built-in server (PHP 5.4 or later)

$ cd /path/to/codeigniter
$ bin/server.sh

Update CodeIgniter

$ cd /path/to/codeigniter
$ composer update

You must update files manually if files in application folder or index.php change. Check CodeIgniter User Guide.

Reference

Related Projects for CodeIgniter 3.x

codeigniter-composer-installer's People

Contributors

indrakaw avatar kenjis avatar rdlabo avatar ricpelo avatar seka avatar sukrosono avatar totoprayogo1916 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codeigniter-composer-installer's Issues

Nginx in subfolder

Racking my brain on getting this to work. I have have a WP install and other things in /home/site/www and trying to install CI in /home/site/www/api

Keep getting 404 errors. Thoughts?

nginx conf below. Thanks!

        location /api {
                root /home/site/www/api/public;
                index index.php;
                try_files $uri $uri/ /index.php?$args;

                location ~ \.php$ {
                        try_files $uri =404;
                        include fastcgi_params;
                        fastcgi_param SCRIPT_FILENAME $request_filename;
                        fastcgi_split_path_info ^(.+\.php)(/.+)$;
                        fastcgi_pass unix:/var/run/php_fpm.sock;
                }
        }

Fatal error on server

I am using php7.1, with apache2, got this error after server start and hitting the url http://localhost:8000

agldev@agldev:/var/www/html/codeigniter-projects/ciblog$ bin/server.sh
PHP 7.1.12-3+ubuntu16.04.1+deb.sury.org+1 Development Server started at Tue Dec 19 20:50:16 2017
Listening on http://127.0.0.1:8000
Document root is /var/www/html/codeigniter-projects/ciblog/public
Press Ctrl-C to quit.
[Tue Dec 19 20:50:27 2017] PHP Warning:  Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Tue Dec 19 20:50:27 2017] PHP Fatal error:  Unknown: Failed opening required '/var/www/html/codeigniter-projects/ciblog/public/bin/router.php' (include_path='.:/usr/share/php') in Unknown on line 0
[Tue Dec 19 20:50:36 2017] PHP Warning:  Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Tue Dec 19 20:50:36 2017] PHP Fatal error:  Unknown: Failed opening required '/var/www/html/codeigniter-projects/ciblog/public/bin/router.php' (include_path='.:/usr/share/php') in Unknown on line 0

Have named routes

Hello
First of all, thank you for your remarkable work.
I've been using your repository under codeigniter 3 for some time now.
And I'd like to know if you have thought of making one to have named routes and instead of site_url('controller/method') make site_url('route_name') ?

Do you have any plans to create some tools for ORM or PSR?

We set up a codeigniter project by this installer and then installed the Libraries.

$ composer create-project kenjis/codeigniter-composer-installer codeigniter
$ bin/my-codeigniter.sh

It helped us very much!
Do you have any plans to create some tools for ORM or PSR?
Thanks!

Virtual Host

Hello,

I have a virtual host on directory "public".

But i can't access to parent directory...

And i don't want see in the URL "public".

Could you help me?

codeigniter 4 wrong packages version

i try intstall codeigniter 4 from branch 4.x
but composer install codeidniter 3.2.x

"codeigniter/framework": "dev-develop" <<< ci 3.2.x not codeigniter4

please fix it

application folder exists twice

Why exists the application directory twice? It's in the root directory and then in vendor/codeigniter/framework/application. Do i need this second folder?

Nginx configuration

I can not make it work in nginx.

My tree of files:

$ tree -L 2 /var/www/myproj
.
├── api # codeigniter
│   ├── application
│   ├── bin
│   ├── composer.json
│   ├── composer.lock
│   ├── public
│         ├── .htaccess
│         ├── index.php
│   ├── README.md
│   └── vendor
├── bower.json
├── CHANGELOG.md
├── css
│   └── app.css
├── images
│   ├── favicon-apple-touch-icon-114x114.png
│   ├── favicon-apple-touch-icon-72x72.png
│   ├── favicon-apple-touch-icon.png
│   ├── favicon.png
├── index.html
├── js # angular files
│   ├── app.module.js
│   ├── components
│   ├── configs
│   ├── controllers
│   ├── functions.js
│   └── models
├── lib # bower files
│   ├── angular
│   ├── angular-animate    ...

See my settings:

  • file /etc/nginx/sites-enabled/myproj.conf
server {
  listen 80;
  listen [::]:80 ipv6only=on;
  server_name localhost;

  root /var/www/myproj;
  index index.html index.htm index.php;

  location /api/ {
    try_files $uri /api/public/$uri /api/public/$uri/ /api/public/index.php?$request_uri;
  }

  location ~* \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

    # With php5-fpm:
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;

    fastcgi_intercept_errors on;
    fastcgi_param  CI_ENV           development;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param  SCRIPT_NAME      $fastcgi_script_name;
    fastcgi_read_timeout 150;
  }
}
  • file /etc/nginx/fastcgi_params (untouched - ubuntu's default)
fastcgi_param   QUERY_STRING            $query_string;
fastcgi_param   REQUEST_METHOD          $request_method;
fastcgi_param   CONTENT_TYPE            $content_type;
fastcgi_param   CONTENT_LENGTH          $content_length;

fastcgi_param   SCRIPT_FILENAME         $request_filename;
fastcgi_param   SCRIPT_NAME             $fastcgi_script_name;
fastcgi_param   REQUEST_URI             $request_uri;
fastcgi_param   DOCUMENT_URI            $document_uri;
fastcgi_param   DOCUMENT_ROOT           $document_root;
fastcgi_param   SERVER_PROTOCOL         $server_protocol;

fastcgi_param   GATEWAY_INTERFACE       CGI/1.1;
fastcgi_param   SERVER_SOFTWARE         nginx/$nginx_version;

fastcgi_param   REMOTE_ADDR             $remote_addr;
fastcgi_param   REMOTE_PORT             $remote_port;
fastcgi_param   SERVER_ADDR             $server_addr;
fastcgi_param   SERVER_PORT             $server_port;
fastcgi_param   SERVER_NAME             $server_name;

fastcgi_param   HTTPS                   $https if_not_empty;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param   REDIRECT_STATUS         200;

I tried some variations on the location /api/ block (rewrite, alias, root, try_files) unsuccessful.

HMVC not loaded

Hi,
I have followed HMVC instruction to configure but it is giving me 404 on CentOS 6. I have observed a issue is belonging to case-sensitive.

Removing the public url

Hi don't get the last issue for this.

How can I remove the public folder? I just tried to remove the public folder and move .htaccess and index.php in root folder "htdocs\kenjis" just like the original setup of Code Igniter when you extracted it .
Here' the error I've encountered

"Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php"

What should I do?
Thank you.

CodeIgniter Developer Toolbar wrong repo name after unzip, nothing is copied

in your instal.php, replace

'codeigniter-develbar' => array(
                'site'  => 'github',
                'user'  => 'jcsama',
                'repos' => 'codeigniter-develbar',
                'name'  => 'codeigniter-develbar',
                'dir'   => array('config','core', 'third_party','controllers'),
                'msg'   => 'See https://github.com/JCSama/CodeIgniter-develbar',
                'example_branch' => 'master',
            ),

with

'codeigniter-develbar' => array(
                'site'  => 'github',
                'user'  => 'jcsama',
                'repos' => 'CodeIgniter-develbar',
                'name'  => 'CodeIgniter-develbar',
                'dir'   => array('config','core', 'third_party','controllers'),
                'msg'   => 'See https://github.com/JCSama/CodeIgniter-develbar',
                'example_branch' => 'master',
            ),

see the camel case on repos & name ?

Twig Installer

Please add a feature to install Twig Library. Thanks.

CI4 Composer postInstall Error

Hey Kenji,

TLDR;

vendor/codeigniter4/framework/rewrite.php and vendor/codeigniter4/framework/serve appear to be missing from the codeigniter download causing your installer to throw errors.

So, I used your installer just now and it looks like there's some changes in CI4 that's causing installation errors with your postInstall() script.

> Kenjis\CodeIgniter\Installer::postInstall
Script Kenjis\CodeIgniter\Installer::postInstall handling the post-create-project-cmd event terminated with an exception                                                                                                   
[ErrorException]                                                                                   
 copy(vendor/codeigniter4/framework/rewrite.php): failed to open stream: No such file or directory  

I'm unsure why it's not throwing an exception for serve as well as that seems to not be in vendor/codeigniter4/framework/ either.

How to setup Xdebug debugging environment

I'm having difficulty setting up XDebug debugging environment with this composer style setup. Does anyone have a working setup and could share that? I have the app running in VM, I dont have a glue what to define in Path Mapping.

I have a breaking point in code (I use Eclipse), but it does not have any effect. Xdebug is properly installed.

can't get packagist json

got a strange error using composer.

composer require kenjis/codeigniter-composer-installer
"https://packagist.org/packages.json" does not contain valid JSON
Parse error on line 1:

^
Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
https://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date

                                                                               
  [Composer\Downloader\TransportException]                                     
  The "http://packagist.org/p/kenjis/codeigniter-composer-installer%248da5574
  e0b9097e89bcee9abeb0a6b45abffdce9c7562c26766e270d27f5dd06.json" file could 
  not be downloaded (HTTP/1.1 302 Found)

same problem when i cloned your repo and do a composer install.

How to remove "public" from URL using .htaccess?

I had tried to remove "public" from URL for many times but every time I ran into different problems.
Many of the times, I get loop of "public/public/public..."
And while installing in subdomain, "public/index.php" can not be removed.

Please I need help on this! Don't want to remove this folder structure just want to make public folder as document root in Apache server. So that "public" doesnot appear in my url.

Any help will be appreciated?

Extends CI_Controller

Hello,

All Works for me when my controllers extends of CI_Controller.

But when i do :

`class MY_Commun extends CI_Controller {

AND

class commentaire extends MY_Commun {`

I have the error following....

Fatal error: Class 'MY_Commun' not found in C:\wamp\www\ci_articles\application\controllers\Commentaire.php

Why my class is not loaded?

When i do :
Controller_1 extends CI_Controller and
Controller_2 extends CI_Controller , inside controllers folder, it's works !

PHP information wrong

When update with "composer update" the screen shows errors below:

codeigniter4/framework dev-develop requires php >=7.1 -> your PHP version (7.0.21) does not satisfy that requirement. codeigniter4/framework dev-develop requires php >=7.1 -> your PHP version (7.0.21) does not satisfy that requirement. Installation request for codeigniter4/framework dev-develop -> satisfiable by codeigniter4/framework[dev-develop].

actual PHP version, running with phpinfo(); is 7.1.0 also set in my MAMP, so the actual message is false.

bin/server.sh crashes after DB access attempt

Hi there, I am running a fresh installation and the bin/server.sh script. I installed Ion Auth 2 and when I try to access localhost:8000/auth, I get a database error, and on second load, I get the following error:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'bin/router.php' (include_path='.:') in Unknown on line 0

The terminal looks like this

[Fri Feb 3 10:38:52 2017] 127.0.0.1:57893 [200]: /auth
[Fri Feb 3 10:39:03 2017] 127.0.0.1:57895 Invalid request (Unexpected EOF)

Every subsequent page load will fail with the same error and I have to restart the server. The exact same page works fine on my local Apache installation, no database error, no EOF error.

Errors when using composer.phar

If you install composer via the standard method from their website:

curl -sS https://getcomposer.org/installer | php

The installer doesn't work correctly:

php composer.phar create-project kenjis/codeigniter-composer-installer codeigniter
Installing kenjis/codeigniter-composer-installer (v0.4.0)
  - Installing kenjis/codeigniter-composer-installer (v0.4.0)
    Downloading: 100%         

Created project in codeigniter
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing codeigniter/framework (3.0.3)
    Loading from cache

Writing lock file
Generating autoload files
> Kenjis\CodeIgniter\Installer::postInstall
> composer update
sh: 1: composer: not found
Script composer update handling the post-install-cmd event returned with an error

  [RuntimeException]                        
  Error Output: sh: 1: composer: not found  

Granted it's not complex to fix, but if you don't have permission to move composer to a global bin folder or don't know how to use the bin folder in your home directory (or just don't want to) then it doesn't work.

Cannot find index.php

I have tried

$ composer create-project kenjis/codeigniter-composer-installer example

However, it is found that it is missing index.php in the example folder. If the codeigniter is downloaded from the official page, it would include index.php.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.