Valet-plus: Feature request: Pimcore driver

Created on 25 Feb 2018  Â·  8Comments  Â·  Source: weprovide/valet-plus

I'm looking for the Pimcore driver. Any help will be appreciated :)
https://pimcore.com/en
https://pimcore.com/docs

Enhancement HELP WANTED

Most helpful comment

For 5.x? I have something okish...

Den ons 18 apr. 2018 15:32Jelle Siderius notifications@github.com skrev:

Would be nice :)

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/weprovide/valet-plus/issues/112#issuecomment-382387523,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA7Hfjg0i7HqH6G5-Tl32xx0CXqu_WREks5tp0CFgaJpZM4SSW-Q
.

All 8 comments

Would be nice :)

For 5.x? I have something okish...

Den ons 18 apr. 2018 15:32Jelle Siderius notifications@github.com skrev:

Would be nice :)

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/weprovide/valet-plus/issues/112#issuecomment-382387523,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA7Hfjg0i7HqH6G5-Tl32xx0CXqu_WREks5tp0CFgaJpZM4SSW-Q
.

@stefan-h-singer,
Would be nice to see that, if it gets pimcore 5.x up and running.

It's a bit of a hack, but works for us.
LocalValetDriver.php (put this in /web since that's the directory you should link)

<?php

/** Valet driver for Pimcore 5 */
class LocalValetDriver extends ValetDriver
{
    /**
     * Determine if the driver serves the request.
     *
     * @param  string  $sitePath
     * @param  string  $siteName
     * @param  string  $uri
     * @return bool
     */
    public function serves($sitePath, $siteName, $uri)
    {
        if (file_exists($sitePath.'/pimcore')) {
             return true;
        }

        return false;
    }

    /**
     * Determine if the incoming request is for a static file.
     *
     * @param  string  $sitePath
     * @param  string  $siteName
     * @param  string  $uri
     * @return string|false
     */
    public function isStaticFile($sitePath, $siteName, $uri)
    {
        // remove cache busting part from url
        if(strpos($uri, '/cache-buster') === 0) {
            // https://stackoverflow.com/questions/25543974/how-to-get-string-after-second-slash-in-url-using-php
            $last = explode("/", $uri, 3);
            $uri = '/'.$last[2];
        }
        if (file_exists($staticFilePath = $sitePath.'/var/assets'.$uri) || file_exists($staticFilePath = $sitePath.$uri)) {
            return $staticFilePath;
        }

        return false;
    }

    /**
     * Get the fully resolved path to the application's front controller.
     *
     * @param  string  $sitePath
     * @param  string  $siteName
     * @param  string  $uri
     * @return string
     */
    public function frontControllerPath($sitePath, $siteName, $uri)
    {
        if(strpos($uri, '/install') === 0) {
            return $sitePath.'/install.php'; 
        }

        return $sitePath.'/app.php';
    }
}

Great, my 5.x is working now! Thank you!

@stefan-h-singer Could you provide a PR?

If the above code is fine, sure!

Den tors 19 apr. 2018 18:57Lou van der Laarse notifications@github.com
skrev:

@stefan-h-singer https://github.com/stefan-h-singer Could you provide a
PR?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/weprovide/valet-plus/issues/112#issuecomment-382807645,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA7HfvZhOwVMjXBtx_M5s-nAHVCadzJRks5tqMHwgaJpZM4SSW-Q
.

@stefan-h-singer Yes, looks fine to me. Can't test it but going off the reactions in this thread I would say, yes fine to me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Igloczek picture Igloczek  Â·  4Comments

eclectic-coding picture eclectic-coding  Â·  4Comments

mantebal picture mantebal  Â·  4Comments

Sironheart picture Sironheart  Â·  3Comments

dingo-d picture dingo-d  Â·  4Comments