Webiny\Component\Bootstrap\ApplicationClasses\Application::getWebPath PHP Method

getWebPath() public method

Get application web path.
public getWebPath ( ) : string
return string
    public function getWebPath()
    {
        $webPath = $this->environment->getCurrentEnvironmentConfig()->get('Domain', false);
        if (!$webPath) {
            $webPath = Request::getInstance()->getCurrentUrl(true)->getDomain() . '/';
        }
        return $webPath;
    }

Usage Example

Example #1
0
 public function testGetWebPath()
 {
     $env = Environment::getInstance();
     $env->initializeEnvironment(__DIR__ . '/../DemoApp/');
     $app = new Application($env);
     $this->assertSame('http://www.myapp.com/', $app->getWebPath());
 }