When building some of my PHP apps, a lot of the functionality could be coded using PEAR/PECL modules, however, the fact that some people using it may not have the access to install things, It poses a puzzler for me.
在构建我的一些PHP应用程序时,许多功能可以使用PEAR / PECL模块进行编码,但是,有些人使用它可能无法安装东西,这对我来说是一个让人感到困惑的事情。
Should I forsake some users to use PEAR/PECL for functionality, where these will allow me to have a system coded up quicker than if I wrote my own functionality, but eans that it will exclude certain people from using it.
我是否应该放弃一些用户使用PEAR / PECL来实现功能,这使我能够比编写自己的功能更快地编写系统编码,但是它会排除某些人使用它。
9 个解决方案
#1
5
It partly depends on how much time you have, and the purpose of the project. If you're just trying to make something that works, go with PEAR/PECL. If you're trying to learn to be a better programmer, and you have the time, then I'd recommend taking the effort to write your own versions. Once you understand the innards of whatever you're trying to replace, you may want to switch to the PEAR/PECL version so that you're not wasting time reimplementing what has already been implemented...
这在一定程度上取决于你有多少时间,以及项目的目的。如果您只想尝试制作有用的东西,请选择PEAR / PECL。如果你想学习成为一个更好的程序员,并且你有时间,那么我建议你努力编写自己的版本。一旦你理解了你要替换的内容,你可能想要切换到PEAR / PECL版本,这样你就不会浪费时间重新实现已经实现的内容......
...but on the other hand, preexisting tools don't always do exactly what you need, and sometimes have overhead that doesn't do you any good. This is why Unix command-line tools are so small and narrow of purpose; nobody really needs a version of 'ls' that can do anything besides what 'ls' can currently do. Your version of whatever PEAR library will, by virtue of being written by you, do exactly what you need doing. It requires some careful thought...
...但另一方面,预先存在的工具并不总能完全满足您的需求,有时会产生对您没有任何好处的开销。这就是Unix命令行工具如此小而且目的狭窄的原因;除了现在可以做的事情之外,没有人真正需要能够做任何事情的'ls'版本。您的任何PEAR库的版本将由您编写,完全符合您的需要。需要仔细考虑一下......
...but on the gripping hand, don't spend too much time thinking about it. Spend five minutes, make a decision, and start coding. Even if you make the wrong decision, you'll at least have gotten more practice coding. :-)
......但是在握紧的手上,不要花太多时间思考它。花五分钟,做出决定,然后开始编码。即使你做出了错误的决定,你至少也会得到更多的练习编码。 :-)
#2
5
Save on development time by developing with the pear libraries, and provide the libraries bundled in what you distribute (though you'll have to make sure it obeys licensing requirements)
通过使用pear库进行开发来节省开发时间,并提供捆绑在您所分发内容中的库(尽管您必须确保它遵守许可要求)
I would not depend on certain PECL extensions being installed unless you're doing something particularly related to one (say an XDebug web-frontend or something), the majority of installs will be carrying a fairly vanilla set of extensions.
我不会依赖于安装某些PECL扩展,除非你正在做一些特别与之相关的事情(例如XDebug网络前端或其他东西),大多数安装将带有一套相当普通的扩展。
#3
1
My suggestion is to start with assuming PEAR/PECL modules, and get the rest of the code done. Then, once you've got most of your code working the way you want, you can evaluate going back and piece by piece replacing the outside code with your own. Plus, by then you'll have a better idea of the impact using those has on your userbase.
我的建议是从假设PEAR / PECL模块开始,并完成剩下的代码。然后,一旦您的大部分代码按照您想要的方式工作,您就可以评估返回并逐个替换外部代码。此外,到那时您将更好地了解这些对您的用户群的影响。
#4
1
Code it initially using PEAR/PECL and if you get people asking for a non PEAR/PECL version, start coding your own alternatives then for such a version.
最初使用PEAR / PECL进行编码,如果你让人们要求非PEAR / PECL版本,那么就开始为这样的版本编写自己的替代品。
The initial development will go much faster with this, and you may find that no-one cares about requiring 3rd party libraries once you have started releasing apps.
最初的开发速度会快得多,你可能会发现,一旦你开始发布应用程序,没有人会关心要求第三方库。
#5
1
Use PEAR but allow for including the PEAR packages inside your project. All PEAR packages can be separately downloaded from http://pear.php.net/ and can be put anywhere. Depending on convenience and licensing issues you could then package all the required PEAR files with your project or tell users how to download and "install" them.
使用PEAR但允许在项目中包含PEAR包。所有PEAR包都可以从http://pear.php.net/单独下载,可以放在任何地方。根据便利性和许可问题,您可以将所有必需的PEAR文件打包到您的项目中,或告诉用户如何下载和“安装”它们。
#6
0
What I do most times is I'll never use PEAR installed globally on a server. Versions can change and affect your application.. Instead I have a config file (in my case XML) that lists all the packages required and their versions. The installer connects to my personal FTP repository and downloads and installs all the PEAR packages locally in $PROJECTBASE/lib/pear/ .. And PEAR is run locally instead of globally. Something you may want to consider.
我最常做的是我永远不会在服务器上全局安装PEAR。版本可以更改并影响您的应用程序。相反,我有一个配置文件(在我的例子中是XML),列出了所需的所有软件包及其版本。安装程序连接到我的个人FTP存储库,并在$ PROJECTBASE / lib / pear /中本地下载并安装所有PEAR包。而PEAR是在本地而不是全局运行的。你可能想要考虑的事情。
#7
0
Using PEAR is no problem, if users do not have root access to their webserver, they can simply download the PHP files from pear.php.net and add it to their include path. PECL's a little more tricky to work around, since there's often no way to install new modules without root access.
使用PEAR没有问题,如果用户没有对其Web服务器的root访问权限,他们只需从pear.php.net下载PHP文件并将其添加到其包含路径即可。 PECL的解决方法有点棘手,因为没有root访问权限,通常无法安装新模块。
#8
0
You need to watch out because a lot of modules in pear are really of pretty low quality.
你需要注意,因为梨中的很多模块都非常低质。
Some are great, don't get me wrong, but don't assume that anything in pear, by virtue of being in pear, is at any given quality. Which means you need to at least skim the source of a pear module before deciding to use it, which for simple enough tasks may take more time than going without pear.
有些是伟大的,不要误解我的意思,但不要以为梨中的任何东西都是梨,任何特定的质量。这意味着你需要在决定使用之前至少浏览梨模块的源代码,这对于简单的任务可能比没有梨花费更多的时间。
pecl is different, however. Extensions tend to be better vetted and tested, else they'd crash php.
然而,pecl是不同的。扩展往往更好的审查和测试,否则他们崩溃PHP。
#9
0
Reiterating much of what's already been said: http://www.codinghorror.com/blog/archives/001145.html
重申已经说过的大部分内容:http://www.codinghorror.com/blog/archives/001145.html
#1
5
It partly depends on how much time you have, and the purpose of the project. If you're just trying to make something that works, go with PEAR/PECL. If you're trying to learn to be a better programmer, and you have the time, then I'd recommend taking the effort to write your own versions. Once you understand the innards of whatever you're trying to replace, you may want to switch to the PEAR/PECL version so that you're not wasting time reimplementing what has already been implemented...
这在一定程度上取决于你有多少时间,以及项目的目的。如果您只想尝试制作有用的东西,请选择PEAR / PECL。如果你想学习成为一个更好的程序员,并且你有时间,那么我建议你努力编写自己的版本。一旦你理解了你要替换的内容,你可能想要切换到PEAR / PECL版本,这样你就不会浪费时间重新实现已经实现的内容......
...but on the other hand, preexisting tools don't always do exactly what you need, and sometimes have overhead that doesn't do you any good. This is why Unix command-line tools are so small and narrow of purpose; nobody really needs a version of 'ls' that can do anything besides what 'ls' can currently do. Your version of whatever PEAR library will, by virtue of being written by you, do exactly what you need doing. It requires some careful thought...
...但另一方面,预先存在的工具并不总能完全满足您的需求,有时会产生对您没有任何好处的开销。这就是Unix命令行工具如此小而且目的狭窄的原因;除了现在可以做的事情之外,没有人真正需要能够做任何事情的'ls'版本。您的任何PEAR库的版本将由您编写,完全符合您的需要。需要仔细考虑一下......
...but on the gripping hand, don't spend too much time thinking about it. Spend five minutes, make a decision, and start coding. Even if you make the wrong decision, you'll at least have gotten more practice coding. :-)
......但是在握紧的手上,不要花太多时间思考它。花五分钟,做出决定,然后开始编码。即使你做出了错误的决定,你至少也会得到更多的练习编码。 :-)
#2
5
Save on development time by developing with the pear libraries, and provide the libraries bundled in what you distribute (though you'll have to make sure it obeys licensing requirements)
通过使用pear库进行开发来节省开发时间,并提供捆绑在您所分发内容中的库(尽管您必须确保它遵守许可要求)
I would not depend on certain PECL extensions being installed unless you're doing something particularly related to one (say an XDebug web-frontend or something), the majority of installs will be carrying a fairly vanilla set of extensions.
我不会依赖于安装某些PECL扩展,除非你正在做一些特别与之相关的事情(例如XDebug网络前端或其他东西),大多数安装将带有一套相当普通的扩展。
#3
1
My suggestion is to start with assuming PEAR/PECL modules, and get the rest of the code done. Then, once you've got most of your code working the way you want, you can evaluate going back and piece by piece replacing the outside code with your own. Plus, by then you'll have a better idea of the impact using those has on your userbase.
我的建议是从假设PEAR / PECL模块开始,并完成剩下的代码。然后,一旦您的大部分代码按照您想要的方式工作,您就可以评估返回并逐个替换外部代码。此外,到那时您将更好地了解这些对您的用户群的影响。
#4
1
Code it initially using PEAR/PECL and if you get people asking for a non PEAR/PECL version, start coding your own alternatives then for such a version.
最初使用PEAR / PECL进行编码,如果你让人们要求非PEAR / PECL版本,那么就开始为这样的版本编写自己的替代品。
The initial development will go much faster with this, and you may find that no-one cares about requiring 3rd party libraries once you have started releasing apps.
最初的开发速度会快得多,你可能会发现,一旦你开始发布应用程序,没有人会关心要求第三方库。
#5
1
Use PEAR but allow for including the PEAR packages inside your project. All PEAR packages can be separately downloaded from http://pear.php.net/ and can be put anywhere. Depending on convenience and licensing issues you could then package all the required PEAR files with your project or tell users how to download and "install" them.
使用PEAR但允许在项目中包含PEAR包。所有PEAR包都可以从http://pear.php.net/单独下载,可以放在任何地方。根据便利性和许可问题,您可以将所有必需的PEAR文件打包到您的项目中,或告诉用户如何下载和“安装”它们。
#6
0
What I do most times is I'll never use PEAR installed globally on a server. Versions can change and affect your application.. Instead I have a config file (in my case XML) that lists all the packages required and their versions. The installer connects to my personal FTP repository and downloads and installs all the PEAR packages locally in $PROJECTBASE/lib/pear/ .. And PEAR is run locally instead of globally. Something you may want to consider.
我最常做的是我永远不会在服务器上全局安装PEAR。版本可以更改并影响您的应用程序。相反,我有一个配置文件(在我的例子中是XML),列出了所需的所有软件包及其版本。安装程序连接到我的个人FTP存储库,并在$ PROJECTBASE / lib / pear /中本地下载并安装所有PEAR包。而PEAR是在本地而不是全局运行的。你可能想要考虑的事情。
#7
0
Using PEAR is no problem, if users do not have root access to their webserver, they can simply download the PHP files from pear.php.net and add it to their include path. PECL's a little more tricky to work around, since there's often no way to install new modules without root access.
使用PEAR没有问题,如果用户没有对其Web服务器的root访问权限,他们只需从pear.php.net下载PHP文件并将其添加到其包含路径即可。 PECL的解决方法有点棘手,因为没有root访问权限,通常无法安装新模块。
#8
0
You need to watch out because a lot of modules in pear are really of pretty low quality.
你需要注意,因为梨中的很多模块都非常低质。
Some are great, don't get me wrong, but don't assume that anything in pear, by virtue of being in pear, is at any given quality. Which means you need to at least skim the source of a pear module before deciding to use it, which for simple enough tasks may take more time than going without pear.
有些是伟大的,不要误解我的意思,但不要以为梨中的任何东西都是梨,任何特定的质量。这意味着你需要在决定使用之前至少浏览梨模块的源代码,这对于简单的任务可能比没有梨花费更多的时间。
pecl is different, however. Extensions tend to be better vetted and tested, else they'd crash php.
然而,pecl是不同的。扩展往往更好的审查和测试,否则他们崩溃PHP。
#9
0
Reiterating much of what's already been said: http://www.codinghorror.com/blog/archives/001145.html
重申已经说过的大部分内容:http://www.codinghorror.com/blog/archives/001145.html