What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

hi guys, i modify Pyz/CategoryStorage, and i want install it in another spryker project, i want add

USLUHK9SQ
USLUHK9SQ Posts: 92 πŸ§‘πŸ»β€πŸš€ - Cadet

hi guys,
i modify Pyz/CategoryStorage, and i want install it in another spryker project, i want add this it to composer package, but how use it after install in other project, ?

Comments

  • Unknown
    edited June 2020

    Hi there!

    I guess this is more a composer question.

    The easier way would be copying the code to the new project.

    On the other hand, you could create a repo on Github (for instance) and adding the reference to your composer.json to that repo, and install the module from there.

    A quick google search gave me this two explanations:
    β€’ for the case where you want to create a composer package: https://blog.jgrossi.com/2013/creating-your-first-composer-packagist-package/
    β€’ for the case you want to install something from a private repo: https://barryvanveen.nl/blog/55-installing-a-private-package-with-composer
    Just as a disclaimer: I’ve never done either of them πŸ™‚

  • UKEP86J66
    UKEP86J66 Posts: 208 πŸ§‘πŸ»β€πŸš€ - Cadet

    Some extra info - as you cannot add to the Spryker vendor namespaces you will have to update the config to add the namespace of your shared composer package. This is done with

    $config[KernelConstants::CORE_NAMESPACES] = [
        'SprykerShop',
        'SprykerMiddleware',
        'SprykerEco',
        'Spryker',
        'MyNewNamespace',
    ]; 
    
  • UKEP86J66
    UKEP86J66 Posts: 208 πŸ§‘πŸ»β€πŸš€ - Cadet

    Here's an example of one of our shared packages (sorry, shameless plug πŸ™‚ )
    https://packagist.org/packages/inviqa/spryker-debug

  • USLUHK9SQ
    USLUHK9SQ Posts: 92 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited June 2020

    @UKEP86J66 for example i change name (from catalogStorage to myCustomCatalogStorage), install it, add like above, and data about CatalogStorage should go from (myCustomCatalogStorage) not from (Spryker/CatalogStorage) ?

  • UKEP86J66
    UKEP86J66 Posts: 208 πŸ§‘πŸ»β€πŸš€ - Cadet

    If you are overriding the module like you would in Pyz the module name would stay the same. Because we set the namespace in CORE_NAMESPACES the Spryker resolvers will find your code before Pyz

  • USLUHK9SQ
    USLUHK9SQ Posts: 92 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited June 2020

    @UKEP86J66

    $config[KernelConstants::CORE_NAMESPACES] = [
        'SprykerShop',
        'SprykerMiddleware',
        'SprykerEco',
        'Spryker',
        'myCustomCatalogStorage',
    ]; 
    

    and data about it will be goes from this point ?

  • UKEP86J66
    UKEP86J66 Posts: 208 πŸ§‘πŸ»β€πŸš€ - Cadet

    So you need to
    β€’ Copy Pyz/CategoryStorage somewhere outside of the project, update the namespaces and push to packagist
    β€’ Update the config so Spryker can see the new namespace

  • USLUHK9SQ
    USLUHK9SQ Posts: 92 πŸ§‘πŸ»β€πŸš€ - Cadet

    like above ?

  • UKEP86J66
    UKEP86J66 Posts: 208 πŸ§‘πŸ»β€πŸš€ - Cadet

    @USLUHK9SQ - not quite like that. Packagist has 2 namespaces, a vendor name and a package name.

  • UKEP86J66
    UKEP86J66 Posts: 208 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited June 2020

    The package name will be the same as it is at the moment (CategoryStorage)

  • UKEP86J66
    UKEP86J66 Posts: 208 πŸ§‘πŸ»β€πŸš€ - Cadet

    The vendor name will be different. For our example our vendor name is Inviqa

  • USLUHK9SQ
    USLUHK9SQ Posts: 92 πŸ§‘πŸ»β€πŸš€ - Cadet

    okey so package name will be kacper/CatalogStorage ? right ?

  • UKEP86J66
    UKEP86J66 Posts: 208 πŸ§‘πŸ»β€πŸš€ - Cadet

    Yes looks good πŸ™‚