PHP framework (HMVC, global context, ORM...)

Igor,

I would suggest adding a readme to the github for the project. Without this I would not spend any time looking at it because if the dev did not even have the time to write a readme for this framework then I would make the assumption that it is not worth my time.

Cheers.

2 Likes

Okey, I have nothing contra. But what should I write? I mean, short description even exists. And for complete documentation I really have no time. What exactly would you like to read? Give me some tip.

Basic overview of what it is for, links to demo projects, what is needed to use it (php-mime extension), any thing else for installation/development?, deployment recommendation, language requirements (php 7?), etc

1 Like

Okey

This is not new. The Yii Framework has had this for years.

Aha… I’ve found a couple examples of Yii: https://github.com/yiisoft/yii/tree/master/demos

Do you really mean that this chaos has something similar to my framework?!

But anyway thank’s. Now I anderstand that I’ve created something original.

I decided to install the project (using the Zip file) and now stuck on the following cryptic message and cannot proceed.

Page not found

I would be grateful to know how to setup the framework so that I can continue testing.

I modified 'the following file:

File: /var/www/example.com/public_html/gi-frame/gi-master/project.complex/webroot/index.php

<?php
// added:
declare(strict_types=1);
error_reporting(-1);
ini_set('display_errors', 'true');

//==================================
function vd($var=__line__)
{
    echo '<br><hr>';
        var_dump($var);
    echo '<hr><br>';
}// 

// original script
use GI\Application\Application\Complex\Application;
use GI\Autoloader\Autoloader;
use Core\Module\Providers;

require_once dirname(dirname(__DIR__)) . '/GI/Autoloader/resources.php';

/** @noinspection PhpUnhandledExceptionInspection */
($gi = new Autoloader())->addBaseNamespace('', dirname(__DIR__));



/** @noinspection PhpUnhandledExceptionInspection */
// added
if(0):
  // original
	(new Application(new Providers()))->run();
else:
	// added
	$z = new Application(new Providers());
	vd($z);
	$z->run();
endif;

Output:

/var/www/example.com/public_html/gi-frame/gi-master/project.complex/webroot/index.php:16:
object(GI\Application\Application\Complex\Application)[4]
  private 'moduleLocator' => 
    object(GI\Application\Module\Locator\Locator)[154]
      private 'providers' => 
        object(Core\Module\Providers)[5]
          private 'items' (GI\Application\Module\ProvidersContainer\AbstractContainer) => 
            array (size=3)
              ...

Page not found

In terms of what it does yes. I agree that Yii doesn’t have the nicest code out there, but for RAD it’s awesome.

Framework needs no specific setup. Actually you need virtual host on your web-server with “webroot”-dir as root.

“Page not found” means that path not found. If you use ‘/’ that should be there in module Home. Hm… You call application with web-server or with CLI?

UPDATE And probably you should to start your web-Server as administrator because of symlinks creating.

I assumed the Framework is similar to YIi, Symfony, Laravel or CodeIgniter, all have been previously installed and prefer CodeIgniter because of its simplicity and good documentation. I have been using CodeIgniter for many years.

As mentioned I downloaded the source from Github, unpacked the zip file to my localhost server then navigated to index.php using a browser… and the “Page not found” message appeared.

With the other PHP Frameworks tried I usually have to read the documentation for the correct path settings to get the opening Welcome page to appear.

Is your framework similar to the ones mentioned, if so what settings are required to create the Welcome page?

Okey…

  1. Make dir path/to/test
  2. Unzip there dirs GI, project.complex and project.micro.
  3. Create virtual host with project.complex/webroot as root dir.
  4. Create another virtual host with project.micro/webroot as root dir.
  5. In project.complex in class Home\Module\Locally\Context\Component\Menu\Model\Menu in method getMicro replace host for micro with yours.
  6. Start (probably) web-server as administrator.
  7. Call project.complex/webroot/index.php.

If you would to test Blog you need DB. That is next step…

Is that only for local setup or does the production environment needs that as well? (either of those is very unlikely on a shared hosting plan)

I think, it depends of hoster. By my hoster I’ve create subdomains and need no specific actions for symlink creating

I’ve wrote a README: https://github.com/igor1999/gi/blob/master/README.md

  1. Please tell me if something important failed in description.

  2. English is obviously not my motherlanguage, so if there are a terrible language errors also tell me where.

Let me guess, Deutsche spellcheck? The grammar reminds me of my Swabian mother-in-law’s English.

Anyway, I spotted a few typos:

sheme -> scheme
busyness -> business
pacage -> package
ist -> its
till -> until
extern -> external
Framewor -> Framework
satic -> static
ist -> in

It seems, completely fixed. Thank’s.

1 Like

I applied the changes and “Page not found” message still appeared.

The following file was edited to give more information:

/var/www/example.com/public_html/gi-frame/gi-master/GI/Application/Application/Complex/Application.php

Modifications:

  public function run()
    {
        $calls = $this->getCliFactory()->createTypeOfCall()->isCli()
            ? $this->moduleLocator->getCLICalls()
            : $this->moduleLocator->getWebCalls();

        $found = false;

        foreach ($calls as $call) {
            $found = $call->setModuleLocator($this->moduleLocator)->run();

            if ($found) {
                break;
            }
        }

        if (!$found) {
            $this->handleDefault();
            var_dump($call);
        }

        return $found;
    }


### Output:

Okey, As usually, web-application analizes part of URL called “path”. And I assume you use URL: http://my-server.local/index.php. If this is so path “index.php” clear not found. Please try http://my-server.local/ only.

And another one thing I just forgeted… mod_rewrite should be ON. I don’t know what is a web-server you’ve got… I have Apache and there mod_rewrite allocated in apache/conf/httpd.conf

I use Linux Ubuntu 18.04 and Apache2.

If the Framework is looking for a web page I will create a new http://localhost/index.php and see if that works.

I am not on the desktop at the moment, maybe later today.

I have mod rewrite enabled.

What you mean ’ http://localhost/index.php’?

If there is a problem to create virtual host…

file: apache\conf\extra\httpd-vhosts.conf

add there:

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
    	DocumentRoot "path/to/webroot"
    	ServerName my-server.local	
        <Directory path/to/webroot>
		Order allow,deny 
		Allow from all 
	</Directory>
</VirtualHost>

file: /etc/hosts (I think for your OS is correct)

add there:

127.0.0.1	my-server.local	

If you would to change location of index, that’s possible, but you should to change line:

(new Autoloader())->addBaseNamespace('', dirname(__DIR__));

with another base dir for your application classes.

I’ve made some changes. Load please whole code anew.

And one more detail (I hope last). In root dir of your web-server should be empty directory “symlinks” (name by default). Actually, this directory should be excluded from version control system.

UPDATE Now symlinks-dir created automatically.