Coder Social home page Coder Social logo

Framework detection out of scope? about morse HOT 7 OPEN

rask avatar rask commented on August 16, 2024
Framework detection out of scope?

from morse.

Comments (7)

drewm avatar drewm commented on August 16, 2024

That's an interesting idea. What sort of projects need that ability?

from morse.

telephone avatar telephone commented on August 16, 2024

I can't really think of a proper use for this feature. Dependencies should be handled by Composer, and if a dependency is missing, it'll be obvious via the error message/s

Now an interesting take on this would be checking if framework specific helpers exist (non-namespaced functions). For example, Laravel Helpers or Wordpress functions. In saying that though, I still believe this should be handled by Composer as it deals with dependencies instead of cross-platform environments.

from morse.

drewm avatar drewm commented on August 16, 2024

One of the big benefits of Morse is dealing with situations where you aren't in control of the dependancies. e.g. if you know that your code will often be used with WordPress, and if so, you can call out to some WP function to make life easier.

So I'm interested in this - I'm just not sure if this is a theoretical problem or a real problem to solve.

from morse.

drewm avatar drewm commented on August 16, 2024

Here's a potential real-world usage example:

https://github.com/michelf/php-markdown/blob/master-stable/markdown.php#L70

from morse.

telephone avatar telephone commented on August 16, 2024

@drewm How would you handle version comparison (new functions in v4 versus v5)? Or would you just have a broad check, and leave version comparison to the user?

For frameworks that are decoupled like Laravel, how would you check if one package is installed (such as 'illuminate/database') versus the whole framework?

(Laravel isn't the best example of a decoupled framework 😏).

from morse.

drewm avatar drewm commented on August 16, 2024

Valid question.

from morse.

rask avatar rask commented on August 16, 2024

@telephone

I can't really think of a proper use for this feature. Dependencies should be handled by Composer, and if a dependency is missing, it'll be obvious via the error message/s"

Good point.

Regarding individual packages: as far as I know PHP doesn't provide any means for validating namespace existance. Checking a known class inside a package could work, but there's no knowing when the package author decides to remove the class.

Or perhaps validate that the composer.json file exists in the vendor/author/package directory (this would be safest with using the Composer style author/package naming convention for checks)? Can the vendor directory name be defined by Composer users themselves?

from morse.

Related Issues (6)

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.